Override calculated version for specific commits #1156
Description
In a project I'm working on we would like to use a combined approach for versioning:
- For most (internal) builds, use Nerdbank.GitVersioning to compute a unique version (we would probably configure the version to be something like
2.0.0-dev.{height}
) - For an "official" release, the version for a commit is set explicitly (we have the requirement to always start with a "0" patch version)
We plan to achieve that using git tags - for an untagged commit, use the calculated version, for an tagged commit, read the version from the tag.
I'm aware that the calculated version can be overridden by customizing the MSBuild targets.
The downside of this approach is that the version number will be inconsistent between the MSBuild properties and the version being read out using nbgv
or the Cake alias.
I think it could be a better approach enhance VersionOracle
with that functionality.
This would also enable reuse of the optimizations in Nerdbank.GitVersioning's MSBuild targets.
Would you be open to including such a feature (I'd be happy to provide a PR) or should this requirement better be handled outside of Nerdbank.GitVersioning ?