Documentation
GitVersion is a tool that generates a Semantic Version number based on your Git history. The version number generated from GitVersion can then be used for various different purposes, such as:
- Stamping a version number on artifacts (packages) produced during build.
- Exposing the version number to the build server to version the build itself.
-
Patching
AssemblyInfo.cs(and similar) files with the version number during the build, so the version number is embedded within the compiled binaries themselves.
Consuming GitVersion
There are four different ways to consume GitVersion itself. You can find each of these options below.
Continuous Integration
GitVersion can be used in a Continuous Server pipeline to generate a version number that both labels the build itself and makes the different version variables available to the rest of the build pipeline.
Continuous IntegrationCommand Line
The Command Line gives most flexibility by allowing the execution of GitVersion to be customized
Command LineMSBuild Task
Just install with NuGet and GitVersion will automatically generate assembly version information that is compiled into the resulting artifact.
MSBuild TaskLibrary
Install with NuGet and use GitVersion.Core as a NuGet package. Although this is an unsupported option and the API may break even between minor or patch releases, it's a useful option to some.
LibraryIf you're unsure about how you should consume GitVersion or want to learn more about how it works, read the sections below.
Reference
Technical reference documentation.
Learn
More in depth information about GitVersion
