Build Servers

Depending on the Build Server being used, i.e. TeamCity, Jenkins, etc, GitVersion might need to extra repository information in order to work correctly. GitVersion has knowledge of most of the main CI Providers, and when instructed to do so, will fetch the necessary information in order to correctly assert the semantic version number.

In addition, most build servers allow the setting of the build number within the system, GitVersion knows how to do this automatically. GitVersion has support for quite a few build servers out of the box. Currently we support:

AppVeyor Details on the AppVeyor support in GitVersion
Azure DevOps Details on the Azure DevOps Build Pipeline support in GitVersion
Bamboo Details on the Bamboo support in GitVersion
BitBucket Pipelines Details on the Atlassian BitBucket Pipelines support in GitVersion
Buildkite Details on the Buildkite support in GitVersion
Continua CI Details on the Continua CI support in GitVersion
GitHub Actions Details on the GitHub Actions Workflow support in GitVersion
GitLab CI Details on the GitLab CI support in GitVersion
Jenkins Details on the Jenkins support in GitVersion
MyGet Details on the MyGet support in GitVersion
Octopus Deploy Details on the Octopus Deploy support in GitVersion
TeamCity Details on the TeamCity support in GitVersion

Build Server Variables

When the gitVersion executable is run with the /output buildserver flag instead of outputting JSON, it will export its version variables to the current build server as build-server native variables. For instance if you are running in TeamCity after you run gitversion /output buildserver you will have the %system.GitVersion.SemVer% variable available for you to use in the rest of the build configuration.

MSBuild Properties

When running in MSBuild either from the MSBuild Task or by using /proj myproject.sln parameter, GitVersion will make its version variables available as MSBuild properties in the format $(GitVersion_SemVer).

Environment Variables

When executed within one of the supported build servers mentioned above, GitVersion will also expose the version variables as environment variables, in the format GitVersion_SemVer (and in some circumstances, as GitVersion.SemVer).

Normalization

The standard gitversion executable normalize the branches if there is a build server detected. This behavior can be disabled with the /nonormalize option.

GitHub