Repository navigation
Fix NuGet VMR build number wrapping around on October 1st - #9985
Merged
Merged
Conversation
nuget-client's VMR BuildNumber was computed as PatchNumber % 50000. Since PatchNumber is ((yy - 19) * 1000 + mm * 50 + dd) * 100 + r, the value wraps from ~48xxx to ~1xx on October 1st. Live NuGet packages (e.g. 8.0.0-rc.731) became lower than versions pinned by repos that don't build after nuget-client (roslyn's NuGet.Versioning 8.0.0-rc.48205), failing the sdk build with NU1109 package downgrade errors in tool_projectdata.csproj. Use modulo 100000 instead which yields (mm * 50 + dd) * 100 + r: identical values for January - September, monotonically increasing until the end of the calendar year, and within the UInt16 assembly version limit. Co-authored-by: Copilot <[email protected]> Copilot-Session: 1a609b5e-5df1-40ff-8cd7-cbe2e0e3ff01
|
Azure Pipelines: Successfully started running 1 pipeline(s). 1 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The calculation is correct, preserves prior versions, and resolves the documented October wraparound.
Review effort: Balanced
Findings: None
What changed in this PR
Prevents October NuGet version wraparound from causing NU1109 downgrades in VMR builds.
Changes:
- Expands
_PatchNumbermodulus from 50,000 to 100,000. - Documents the versioning rationale and UInt16 constraint.
| File | Description |
|---|---|
repo-projects/nuget-client.proj |
Corrects NuGet build-number calculation. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
ViktorHofer
enabled auto-merge (squash)
October 6, 2026 11:05
AlesProkop
approved these changes
Oct 6, 2026
Member
|
/backport to release/11.0.1xx |
Contributor
|
Started backporting to |
This was referenced Oct 14, 2026
This was referenced Oct 21, 2026
AlesProkop
added a commit
that referenced
this pull request
Nov 16, 2026
nuget-client got no BuildNumber in VMR builds because the property was evaluated before _PatchNumber is defined, so all NuGet packages were versioned rc.65534 and promotion failed with "already exists ... with different content" on dotnet-tools. This also takes the modulo 100000 change so the number doesn't wrap on October 1st. Co-authored-by: Copilot App <[email protected]>
AlesProkop
added a commit
that referenced
this pull request
Nov 16, 2026
nuget-client got no BuildNumber in VMR builds because the property was evaluated before _PatchNumber is defined, so all NuGet packages were versioned rc.65534 and promotion failed with "already exists ... with different content" on dotnet-tools. This also takes the modulo 100000 change so the number doesn't wrap on October 1st. Co-authored-by: Copilot App <[email protected]>
akoeplinger
pushed a commit
that referenced
this pull request
Nov 16, 2026
…9985) (#11031) Co-authored-by: Copilot App <[email protected]>
akoeplinger
pushed a commit
that referenced
this pull request
Nov 16, 2026
…9985) (#11030) Co-authored-by: Copilot App <[email protected]>
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.
Fixes the
NU1109package downgrade errors breaking every leg of the officialdotnet-unified-buildsince October 1st, e.g. https://dev.azure.com/dnceng/internal/_build/results?buildId=3096775:Root cause
repo-projects/nuget-client.projcomputes NuGet'sBuildNumberas_PatchNumber % 50000(nuget-client'sconfig.propsthen adds 100). Arcade's_PatchNumberis((yy - 19) * 1000 + mm * 50 + dd) * 100 + r, so the result wraps from ~48xxxto ~1xxon October 1st. Unlike Arcade (which carriesPatchNumber / 50000into the assembly patch field), NuGet has no other field to absorb the overflow.Roslyn's
Microsoft.NET.ProjectData.TasksreferencesNuGet.Versioningpinned to8.0.0-rc.48205(8.0.0-rc.48202for source-only builds) from a September VMR build. Roslyn doesn't build after nuget-client in the VMR, and can't in source-only builds (msbuild → roslyn, nuget-client → msbuild). The live NuGet version is now8.0.0-rc.731, which is lower than roslyn's pin, so the sdk fails restore.Fix
Use modulo
100000instead, which yields(mm * 50 + dd) * 100 + r:8.0.0-rc.50731, which is above48205.63399(Dec 31, incl. the +100), so it stays within the UInt16 assembly version limit and below nuget-client's65534dev sentinel.Verified with MSBuild evaluation of Arcade's
_PatchNumberexpression plus nuget-client's +100 offset:Known limitation
The value still wraps at the year boundary (Jan 1st). The previous formula also wrapped there, and this change doesn't fix that. Any NuGet versions pinned in other repos from late-December builds would hit the same downgrade on Jan 1st unless NuGet's major/minor version changes or the scheme is revisited.