Skip to main content

Based on Stack Overflow question/answer, Building projects with MSBuild 15 and Microsoft.NET.Sdk allows users to specify half a dozen version properties. What is the difference between each of these and what is the right way to use them?

---
title: MSBuild Version Properties Cheatsheet
author: natemcmaster
date: September 18, 2019
source: https://stackoverflow.com/questions/42183300/what-is-the-difference-between-various-msbuild-version-properties-such-as-versi
snippet: https://jonlabelle.com/snippets/view/markdown/msbuild-version-properties-cheatsheet
gist: https://gist.github.com/jonlabelle/34993ee032c26420a0943b1c9d106cdc
---

Based on [Stack Overflow](https://stackoverflow.com/questions/42183300/what-is-the-difference-between-various-msbuild-version-properties-such-as-versi)
question/answer, *Building projects with MSBuild 15 and Microsoft.NET.Sdk
allows users to specify half a dozen version properties. What is the difference
between each of these and what is the right way to use them?*

## VersionPrefix

- **Format:** `major.minor.patch`
- **Examples:** `14.2.4`, `0.1.0`, `99.99.99`
- **Meaning:** The normal part of the semver version number. This is used to determine the beginning of the *Version* value.
- **Default:** `1.0.0`

## VersionSuffix

- **Format:** `[0-9A-Za-z-.]*` (arbitrary string)
- **Examples:** `alpha`, `beta`, `build0123`, `rc4-build201701`, `rc.1`, `rc-1`
- **Meaning:** The pre-release label of the version number. Used to determine the ending of a *Version* value.
- **Default:** (empty)

## Version

- **Format:** `major.minor.patch[-prerelease]`
- **Examples:** `5.3.9-beta`, `0.0.1-alpha-01`, `0.0.1-alpha.1`, `2.0.0`
- **Meaning:** This property is the most commonly used property in user projects. Other version properties look to this value as a default. It is also used to generate the value of [System.Reflection.AssemblyInformationalVersionAttribute](https://docs.microsoft.com/dotnet/api/system.reflection.assemblyinformationalversionattribute). The *prerelease* value is optional.
- **Default:** *VersionPrefix* if *VersionSuffix* is empty. *VersionPrefix-VersionSuffix* if *VersionSuffix* is not empty.

> **NOTE:** setting *Version* explicitly will override any *VersionPrefix* or *VersionSuffix* settings.

Also, this typically follows [SemVer](https://semver.org/) rules.

## PackageVersion

- **Format:** `major.minor.patch[-prerelease]`
- **Meaning:** Used to generate the package version when producing a NuGet package from an MSBuild project.
- **Default:** matches *Version*

## AssemblyVersion

- **Format:** `major.minor.patch.revision`
- **Examples:** `4.5.6.2`, `1.0.0.0`
- **Meaning:** Used to generate the value of [System.Reflection.AssemblyVersionAttribute](https://docs.microsoft.com/dotnet/api/system.reflection.assemblyversionattribute). The compiler uses this to determine the final *AssemblyVersion* value, an essential part of assembly identity. See <https://docs.microsoft.com/dotnet/standard/assembly/versioning> for more information.
- **Default:** matches *Version* without the prerelease label.

## FileVersion

- **Format:** `major.minor.patch.buildnumber`
- **Examples:** `1.0.0.43952`, `0.1.0.0`
- **Meaning:** Used to generate the value of [System.Reflection.AssemblyFileVersionAttribute](https://docs.microsoft.com/dotnet/api/system.reflection.assemblyfileversionattribute). This is not required to match *AssemblyVersion*. It is common to add a build number to this version.
- **Default:** matches *AssemblyVersion*

## InformationalVersion

- **Format:** any
- **Meaning:** Used to generate the value of [System.Reflection.AssemblyInformationalVersionAttribute](https://docs.microsoft.com/dotnet/api/system.reflection.assemblyinformationalversionattribute). This attribute can contain any additional version information.
- **Default:** matches *Version*