build: name Nerdbank.GitVersioning in the packable project so Publish.ps1 finds it - #46
Merged
Merged
Conversation
….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>
Up to standards ✅🟢 Issues
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Publish.ps1cannot publish this package. It fails before it gets as far as NuGet:The script locates the project to read the version from by scanning
*.csprojfor the literal textNerdbank.GitVersioning. This repository declares it once inDirectory.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 Updateitem naming the package at project level, which is whatMicrosoftDynamics.Apialready does.Updaterather thanInclude, so the version stays governed centrally byDirectory.Packages.propsand 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.ps1stays 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 wasMicrosoftAzure.Api, fixed underb4f4c21earlier today. I swept the rest and found no others.Verification
Ran the script's own detection and version steps directly, without pushing a tag:
(The
-g<sha>suffix is only because this ran on a branch; onmainit resolves to a clean10.0.121.)dotnet build -c Release— 0 errors, 0 warnings, and the 36 header-redaction tests still pass.🤖 Generated with Claude Code