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 as a software library. 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.

Configuration Details about how GitVersion can be configured to suit your needs
Version Variables The version variables exposed by GitVersion
Requirements Requirements for successful operation of GitVersion
Version Incrementing Details on how GitVersion performs version increments
Version Sources Details on how GitVersion finds a source for its generated version number
Versioning Modes The different modes of versioning GitVersion supports
Build Servers Details on GitVersion's Build Server support

Learn

More in depth information about GitVersion

How it works
Intro to SemVer
Dynamic Repositories
Git Setup
FAQ
Why use GitVersion?
Who is using GitVersion
Credits
Branching Strategies Information about the different branching strategies supported by GitVersion
GitHub