Skip to content

Offset the 18.12 insertion prerelease version to avoid immutable-feed collisions - #7728

Merged
nkolev92 merged 2 commits into
devfrom
dev-nkolev92-insertionVersionOffset
Sep 21, 2026
Merged

nkolev92 merged 2 commits into
devfrom
dev-nkolev92-insertionVersionOffset

Conversation

@nkolev92

@nkolev92 nkolev92 commented Sep 21, 2026 •

Copy link
Copy Markdown
Member

Bug

Fixes:

Description

Why (root cause)

The NuGet client version moved from 7.12 to 8.0, but the Visual Studio package version (NuGet.VisualStudio / NuGet.VisualStudio.Contracts) stayed at 18.12.

The VS version is derived from the NuGet version as 18.((Major - 7) * 12 + Minor), so 7.12 and 8.0 both map to 18.12:

  • 7.12 → 18.((7 - 7) * 12 + 12) = 18.12
  • 8.0 → 18.((8 - 7) * 12 + 0) = 18.12

The prerelease number (-rc.N) comes from the pipeline's build-revision counter, which is keyed off the semantic version. Bumping NuGet to 8.0 started a new counter that restarted at low numbers, so 8.0 builds began producing 18.12.0-rc.2, -rc.3, ... — the same versions already published (with different content) by the earlier 7.12 builds. The immutable feeds we publish to (devdiv nuget-build and, via BAR + darc, dnceng dotnet11) reject those with ExistsAndDifferent ("Package already exists ... with different content"), which is what broke the insertion/promotion.

How (the fix)

Offset the prerelease number by 100 for the 18.12 line, so 8.0 builds produce 18.12.0-rc.10x, safely past the ~rc.2x range already published under 7.12.

  • Scoped to the 18.12 line only (VsTargetMajorVersion.VsTargetMinorVersion == 18.12). It's the only line that overlapped; other lines keep their plain build number.
  • Only applies when a CI BuildNumber is supplied. The local dev default (65534, used when no BuildNumber is provided) is a separate branch and is left untouched — bumping it would overflow the UInt16 assembly/file-version field (SemanticVersion.PreReleaseVersion).

Reasoning (why this won't recur)

This is a one-off caused by allowing a .12 minor (7.12), which collides with the next major's .0 (8.0) under the (Major - 7) * 12 + Minor mapping. Going forward we will not ship a .12 minor: when 8.11 would otherwise roll to "8.12", we'll ship 9.0 instead. Each VS number then stays unique and monotonic, e.g. 8.11 → 18.23, 9.0 → 18.24. Because the VS version changes, the counter/version no longer overlaps previously published packages, so no offset will be needed.

PR Checklist

  • Meaningful title, helpful description and a linked NuGet/Home issue
  • Added tests
  • Link to an issue or pull request to update docs if this PR changes settings, environment variables, new feature, etc.

… collisions

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 0becc65b-18b1-48df-a52f-02cc2822e90a
@nkolev92 nkolev92 added the Engineering Changes related to the build infrastructure of the repo and that do not change product code label Sep 21, 2026
@nkolev92
nkolev92 marked this pull request as ready for review September 21, 2026 16:54
@nkolev92
nkolev92 requested a review from a team as a code owner September 21, 2026 16:54
The vs-test pipeline feeds the 65534 sentinel back in as BuildNumber, so the
unconditional +100 produced 8.0.0.65634, which overflows the assembly/file
version field. Only apply the offset when the result stays <= 65535.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 0becc65b-18b1-48df-a52f-02cc2822e90a
@nkolev92
nkolev92 enabled auto-merge (squash) September 21, 2026 18:01
@nkolev92
nkolev92 merged commit cfb272a into dev Sep 21, 2026
17 of 18 checks passed
@nkolev92
nkolev92 deleted the dev-nkolev92-insertionVersionOffset branch September 21, 2026 18:54
@zivkan zivkan mentioned this pull request Sep 26, 2026
3 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Engineering Changes related to the build infrastructure of the repo and that do not change product code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants