Open KunalSaini opened 1 month ago
Question: Why are you installing the Nerdbank.GitVersioning package if you're not in a git repo and don't want it to set the version?
This is just an example I put together to understand the versioning override mechanism, in reality, we have a lot of separate .net repositories in git and we maintain a custom sdk that brings/enforces common packages/functionality to all repositories/solutions. We are considering putting NBGV in our custom sdk so that its available to all repositories. And each repository owner can switch to NBGV on their own pace (by introducing proper version.json
that makes sense for their repository)
My initial understanding was that if version.json
is absent in a repository , the old/existing versioning mechanism will continue to work, for example lot of repositories use msbuild switch to specify version in our CI/CD environment.
However, when i tries that, it failed to set the version number if the repo is using NBGV.
I see. No, the behavior you're seeing is the intended behavior. That is, elements of it activate even without git and without a version.json file. You can check out our msbuild docs for how to customize the output, but having the package installed without an intention to use it hasn't been a scenario so far.
Hi, I am trying to set NuGet package version of in a csproj file like below.
This project is not in a git repository. The project does not have a
version.json
file. I would have expected it to producev2.2.2
of NuGet package ondotnet build
, however it producesv0.0.0-g
I tried passing in version explicitly
dotnet build /p:Version=2.2.2
, still it produces thev0.0.0-g
package version.I am using dotnet sdk 8.0.102 for build, if that matters.
Question: how do i override this NBGV behavior.