Simpler/faster git specific version builder
| Branch | Status |
|---|---|
| main | |
| release |
View changelog
dotnet tool install FunFair.BuildVersionTo update to latest released version
dotnet tool update FunFair.BuildVersiondotnet new tool-manifest
dotnet tool install FunFair.BuildVersion --localTo update to latest released version
dotnet tool update FunFair.BuildVersion --localSupports release and hotfix branches in the following formats
- release/version
- release/package/version
- release-platform/package/version
- release-platform/version
- hotfix/version
- hotfix/package/version
- hotfix-platform/package/version
- hotfix-platform/version
version can be in the following formats:
- 1
- 1.2
- 1.2.3
- Release branches: 1.2.3.4;
- where 4 is a build number passed to the tool
- Pre-Release branches 1.2.3.4-tag
- where
4is a build number passed to the tool - where
tagis generated from the branch name (or matching branch for a pull request if it can be located)
- where
Tag restrictions
- Maximum length before truncating after any processing: 15 characters
- Non alphanumeric characters are replaced with
- - Multiple
-consecutive characters are shrunk to a single one - removes the top folder of the branch when using branches like
feature/nameso that tag is processed onnameonly - For Pull requests, if a branch cannot be located by its SHA hash then the tag will become
pr-idwhereidis the id of the pull request - if no suitable tag can be generated the tag
prereleasewill be used.
-x, --WarningsAsErrors (Default: false) Whether warnings should be errors
-b, --BuildNumber (Default: -1) The build number (use BUILD_NUMBER envrionment variable)
-s, --ReleaseSuffix (Default: ) The release suffix
-p, --Package (Default: ) The package being released
--help Display this help screen.
--version Display version information.
This will attempt to retrieve the build number (counter) from an environment variable:
- BUILD_NUMBER (Set by CI tools like TeamCity)
dotnet buildversiondotnet buildversion --BuildNumber 272or
dotnet buildversion --b272dotnet buildversion --BuildNumber 272 --ReleaseSuffix "product"or
dotnet buildversion -b272 -s"product"dotnet buildversion --BuildNumber 272 --ReleaseSuffix "product" --Package "package"or
dotnet buildversion -b272 -s"product" -p"package"dotnet buildversion --BuildNumber 272 --Package "package"or
dotnet buildversion -b272 -p"package"- Picks up the
BUILD_NUMBERenvironment variable for the build number - If
TEAMCITY_VERSIONenvironment variable is defined then thesystem.build.versionandbuildNumbervariables will be set to match the build version that the tool produces
- If
GITHUB_ENVenvironment variable is defined then theBUILD_VERSIONenvironment variable will be set to match the build version that the tool produces.