GitVersion - Documentation

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:

  1. Stamping a version number on artifacts (packages) produced during build.
  2. Exposing the version number to the build server to version the build itself.
  3. 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 Integration
Command Line

The Command Line gives most flexibility by allowing the execution of GitVersion to be customized

Command Line
MSBuild Task

Just install with NuGet and GitVersion will automatically generate assembly version information that is compiled into the resulting artifact.

MSBuild Task
Library

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.

Library

If 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