Skip to content

build: name Nerdbank.GitVersioning in the packable project so Publish.ps1 finds it - #46

Merged
rolandbanks merged 1 commit into
mainfrom
fix/publish-nerdbank-detection
Sep 3, 2026
Merged

rolandbanks merged 1 commit into
mainfrom
fix/publish-nerdbank-detection

Conversation

@rolandbanks

Copy link
Copy Markdown
Contributor

Summary

Publish.ps1 cannot publish this package. It fails before it gets as far as NuGet:

Could not find a packable project referencing Nerdbank.GitVersioning.

The script locates the project to read the version from by scanning *.csproj for the literal text Nerdbank.GitVersioning. This repository declares it once in Directory.Build.props — which applies it to every project, but leaves it absent from every .csproj, so the scan matches nothing.

The fix

One line: a PackageReference Update item naming the package at project level, which is what MicrosoftDynamics.Api already does.

Update rather than Include, so the version stays governed centrally by Directory.Packages.props and nothing about the build changes — it is a metadata no-op that restores the project-level mention the script looks for.

Fixed this way rather than by changing the detection logic, so Publish.ps1 stays byte-identical across the repositories that share it.

Scope

Only two repositories were affected — the only two declaring the versioning package solely in Directory.Build.props. The other was MicrosoftAzure.Api, fixed under b4f4c21 earlier today. I swept the rest and found no others.

Verification

Ran the script's own detection and version steps directly, without pushing a tag:

Detected: PanoramicData.OData.Client.csproj
ExitCode: 0
Version would be: 10.0.121-gaae7e87b87

(The -g<sha> suffix is only because this ran on a branch; on main it resolves to a clean 10.0.121.)

dotnet build -c Release0 errors, 0 warnings, and the 36 header-redaction tests still pass.

🤖 Generated with Claude Code

….ps1 finds it

Publish.ps1 locates the project to read the version from by scanning *.csproj for the text
"Nerdbank.GitVersioning". This repository declares it once in Directory.Build.props, which
applies it to every project but leaves it absent from every csproj, so the scan matches nothing
and the script fails with "Could not find a packable project referencing Nerdbank.GitVersioning"
before it can determine a version.

Adding the PackageReference Update item, as MicrosoftDynamics.Api already does, restores the
project-level mention the script looks for. Update rather than Include, so the version stays
governed centrally by Directory.Packages.props and nothing about the build changes.

Fixed this way rather than by changing the detection so that Publish.ps1 stays byte-identical
across the repositories that share it.

The same defect was fixed in MicrosoftAzure.Api under b4f4c21. Those two were the only
repositories affected: they are the only ones declaring the versioning package solely in
Directory.Build.props.

Verified by running the script's detection and version steps directly, without pushing a tag:
the packable project is now found and GetBuildVersion exits 0.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@rolandbanks
rolandbanks merged commit 9adb208 into main Sep 3, 2026
2 of 3 checks passed
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

AI Reviewer: first review requested successfully. AI can make mistakes. Always validate suggestions.

Run reviewer

TIP This summary will be updated as you push new changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant