Replace GitVersion with Nerdbank.GitVersioning for unified local + CI versioning#91
Merged
Merged
Conversation
Adopt NBGV so local and CI builds share a single, git-history-driven version computation, replacing the CI-only patch script introduced in #90. - Add version.json with baseline 1.1-preview, public-release refspecs (main, rel/*, PR merges), SemVer 2 package version, and disabled cloudBuild auto-variables. - Add Nerdbank.GitVersioning 3.9.50 PackageReference via Directory.Build.props (with VersionOverride so CosmosDBShell.Fuzzer still works without central package management) and a corresponding entry in Directory.Packages.props. - Replace gitversion.tool with nbgv in .config/dotnet-tools.json. - Delete GitVersion.yml. - Update GitHub Actions workflow and OneBranch pipeline to fetch full git history, restore .NET tools, compute the package version via nbgv get-version, and stop overriding /p:Version, /p:FileVersion, /p:InformationalVersion, /p:PackageVersion on build/publish/pack.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR migrates the repository’s versioning system from GitVersion + CI-only patch scripting to Nerdbank.GitVersioning (NBGV), making version computation deterministic and consistent across local builds and CI.
Changes:
- Introduces
version.jsonas the repo’s version baseline and configuration for NBGV. - Wires NBGV into MSBuild via
Directory.Build.propsand updates central package/tool manifests accordingly. - Updates GitHub Actions and OneBranch pipelines to rely on NBGV instead of manually overriding MSBuild version properties.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
version.json |
Adds NBGV configuration and establishes the baseline version and release ref specs. |
GitVersion.yml |
Removes the legacy GitVersion configuration. |
Directory.Packages.props |
Adds central package version entry for Nerdbank.GitVersioning. |
Directory.Build.props |
Adds NBGV PackageReference to enable MSBuild-time version stamping. |
.github/workflows/validate-and-package.yml |
Switches CI version computation to nbgv get-version and removes MSBuild version overrides. |
.pipelines/CosmosDB-Shell-Official.yml |
Switches OneBranch version computation to nbgv get-version and removes MSBuild version overrides. |
.config/dotnet-tools.json |
Replaces GitVersion tool with nbgv in the local tool manifest. |
Address PR feedback: VersionOverride was applied unconditionally, shadowing the central entry in Directory.Packages.props for every consumer. Use a conditional PackageReference instead so central-PM projects pull the version from Directory.Packages.props and only CosmosDBShell.Fuzzer (which sets ManagePackageVersionsCentrally=false) pins it directly.
mkrueger
approved these changes
May 21, 2026
mkrueger
added a commit
that referenced
this pull request
May 21, 2026
Converts the `Unreleased — since v1.0.273` section to `1.1.4 — 2026-05-21` (first release on the 1.1 line) and adds entries for the PRs that landed after #86 (the last CHANGELOG update): - **Highlights / New features:** multi-line REPL input with `\` continuation and parser-driven incomplete-input detection ([#88](#88)); parser & query diagnostics with line, column, source caret, and "Did you mean…" suggestions ([#87](#87)). - **Documentation:** notes that [docs/navigation.md](docs/navigation.md) and [README](README.md) now document multi-line input. - **Build & pipeline:** versioning moved to [Nerdbank.GitVersioning](https://github.com/dotnet/Nerdbank.GitVersioning); local builds now produce the same versions as CI ([#90](#90), [#91](#91)). PR #89 was a stepping stone superseded by the NBGV migration, so it isn't called out separately. Docs-only change — no code touched.
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
Adopt Nerdbank.GitVersioning (NBGV) as the single source of truth for version computation, replacing both the abandoned GitVersion tool and the CI-only patch-bump script introduced in #90.
NBGV is a Microsoft / .NET Foundation project (MIT-licensed) that derives the patch component from git history (commit count since
version.jsonlast changed) at MSBuild time. This means local developer builds and CI builds now produce identical, deterministic versions — no more1.0.0placeholders when building outside the pipeline.Why
#90 dropped GitVersion in favor of a custom patch-bump script that runs only in CI. Local builds therefore lost meaningful versioning. We needed a replacement that:
major.minorin source.NBGV satisfies all of the above and is already widely used across .NET Foundation repos.
Changes
New:
version.json1.1-preview— bumping major/minor is a one-line edit; patch resets automatically because the file changed.publicReleaseRefSpeccoversmain,rel/*, and PR merge refs. Other branches (includingdev/*) get a-g<sha>suffix to prevent collisions on feeds.nugetPackageVersion.semVer = 2.cloudBuild.*variable injection disabled — we emit the version explicitly in our pipelines instead.Removed:
GitVersion.ymlBuild infrastructure
Directory.Build.props: replaced the oldVersionSuffixblock with a single<PackageReference Include="Nerdbank.GitVersioning" PrivateAssets="all" VersionOverride="3.9.50" />.VersionOverrideis required becauseCosmosDBShell.Fuzzeropts out of central package management.Directory.Packages.props: addedNerdbank.GitVersioning 3.9.50for the central-PM consumers..config/dotnet-tools.json:gitversion.tool→nbgv3.9.50.CI
Both pipelines now fetch full git history (already required by NBGV), restore tools, and call
nbgv get-versiononce for the package version. The redundant/p:Version,/p:FileVersion,/p:InformationalVersion, and/p:PackageVersionoverrides ondotnet build, the per-RIDdotnet publishloop, anddotnet packwere removed — NBGV stamps those automatically..github/workflows/validate-and-package.yml.pipelines/CosmosDB-Shell-Official.ymlVerification
dotnet restore,dotnet build CosmosDBShell.sln -c Release, anddotnet test CosmosDBShell.sln -c Releaseall pass (1074/1074).CosmosDBShell.dllcarries the expected attributes:AssemblyVersion = 1.1.0.0FileVersion = 1.1.0.<commit-hash-short>(NBGV embeds the first 16 bits of the commit SHA into the revision component for per-commit uniqueness)AssemblyInformationalVersion = 1.1.0-preview+808048fc14NuGetPackageVersion = 1.1.0-previewCosmosDBShell --version→CosmosDBShell 1.1.0-preview (808048fc14)versionshell command →1.1.0-preview(existing parser splits on+, unchanged).VersionCommand_UsesInformationalVersiontest still passes.Operational notes
version.jsonand commit. Patch resets to0and increments per commit afterwards.-previewfromversion.json'sversion(or branch torel/1.1).publicReleaseRefSpecget a-g<sha>suffix on the package version, so they cannot collide with official packages on a feed.