Skip to content

Fix: a project reference is packed as a dependency at version 1.0.0 - #418

Merged
rdeago merged 1 commit into
Tenacom:mainfrom
rdeago:fix/417-project-reference-version
Nov 2, 2026
Merged

rdeago merged 1 commit into
Tenacom:mainfrom
rdeago:fix/417-project-reference-version

Conversation

@rdeago

@rdeago rdeago commented Nov 2, 2026

Copy link
Copy Markdown
Member

Checklist of related issues / discussions

Proposed changes

When a project is packed, the nuspec lists each project reference at version 1.0.0, whatever version Buildvana SDK computes for the referenced project.

NuGet gets the version of a project reference by running _GetProjectVersion on the referenced project. That target runs only $(GetPackageVersionDependsOn), then returns $(PackageVersion), or 1.0.0 when the property is empty. GetBuildVersion hooks the build, pack, and restore targets through BeforeTargets, and none of them run in that call. So PackageVersion stayed empty. The regression dates from a17ee83, which replaced Nerdbank.GitVersioning with the Versioning module.

The fix adds GetBuildVersion to GetPackageVersionDependsOn, in src/Buildvana.Sdk/Modules/Versioning/Module.Core.targets. The BeforeTargets list stays as it is, because each of its entries covers a path that GetPackageVersionDependsOn does not reach.

VersioningModuleTests.GetProjectVersion_ReturnsTheComputedVersion runs _GetProjectVersion on a project in a temporary Git repository. The project imports the real targets of the module and of NuGet pack. The test checks the version that _GetProjectVersion returns. Without the fix, the test gets 1.0.0.

The GetBuildVersion section of docs/sdk-modules/versioning.md says that the target also runs when a referencing project is packed.

Additional changes

None.

Types of changes

This pull request introduces the following types of changes:

  • Bug fix
  • New feature
  • Test addition / update (no changes to non-test code)
  • Refactor (no changes in public API syntax or semantics)
  • Performance improvement (no changes in public API syntax or semantics)
  • Documentation update (not including changelog)
  • Dependency addition / update
  • Changes to toolchain configuration
  • Changes to CI (workflows, bot / app configurations)
  • Changes to repository files (.gitattributes, .gitignore)
  • Other

Breaking changes

This pull request introduces breaking changes:

  • Yes
  • No

Checklist

  • For all types of changes:
  • For code changes only:
    • The project builds on my machine, via the provided build script, with zero warnings
    • I have added tests that prove my feature works / my fix is effective
    • I have added / modified XML documentation according to changes in code
    • I have checked that all the links I added or modified in XML documentation point to their intended destination
  • For documentation changes only:
    • I have checked and proofread documentation locally
    • I have checked that all the links I added or modified point to their intended destination

🤖 Generated with Claude Code

Dependent projects run `_GetProjectVersion` on dependees and use whatever version it returns, defaulting to 1.0.0.
`GetBuildVersion` wasn't called by `_GetProjectVersion`, so the version was never computed for dependent projects.
Include `GetBuildVersion` in `GetPackageVersionDependsOn`, which `_GetProjectVersion` depends on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rdeago rdeago added the bug [issue/PR] reports / solves a bug. label Nov 2, 2026
@github-actions github-actions Bot added area:build [issue/PR] affects project files and/or build settings. area:docs [issue/PR] affects documentation (excluding XML documentation that is part of source code). area:code [issue/PR] affects project code (excluding tests). labels Nov 2, 2026
@codecov

codecov Bot commented Nov 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.50%. Comparing base (f08fc6b) to head (28c8470).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #418   +/-   ##
=======================================
  Coverage   87.50%   87.50%           
=======================================
  Files         330      330           
  Lines        9769     9769           
  Branches     1824     1824           
=======================================
  Hits         8548     8548           
  Misses        919      919           
  Partials      302      302           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rdeago rdeago left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review by Claude. Self-review.

👍 Approved.


No blocking findings.

@rdeago
rdeago merged commit 0938391 into Tenacom:main Nov 2, 2026
4 checks passed
@rdeago
rdeago deleted the fix/417-project-reference-version branch November 2, 2026 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:build [issue/PR] affects project files and/or build settings. area:code [issue/PR] affects project code (excluding tests). area:docs [issue/PR] affects documentation (excluding XML documentation that is part of source code). bug [issue/PR] reports / solves a bug.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A project reference is packed as a dependency at version 1.0.0

1 participant