Use your source control revision number in your .NET assembly version.
MSBuild Versioning allows you to build programs with version numbers such as Major.Minor.Revision
, where Revision
is automatically set to your currently checked-out source control revision number.
Currently, this supports Mercurial and Subversion, but the code is super-simple, and adding support for other systems should be pretty easy. If you add some code to support another system, please consider contributing it back to this project!
Download and Setup Instructions
- Your Major and Minor version numbers are specified in a file that is checked in to source control. If you want to go from version 1.9.x to version 2.0.x, you modify the file and commit the change. This makes it easy to have branches for different versions build with the correct version number.
- Your Revision number is automatically set to your currently checked-out Mercurial or Subversion revision number.
- If your working copy has uncommitted changes, the version number will be Major.Minor.Revision.1. The 1 is a hint that this is not a clean build from source control.
- Flexible! Use whatever version format you want. In fact, you can inject other source control information (branch name, revision ID, etc) into any project source file.
- Nothing to install! Simply drop the MSBuildVersioning.dll file into your solution, edit a few files, and you're away. All you need is Visual Studio and your source control command-line program (hg.exe or svn.exe).
- Fast! The MSBuild Versioning build task does nothing if the version doesn't need to be updated, so it doesn't trigger unnecessary builds.
- If a customer reports a problem in a particular version, it’s a piece of cake to check out and build that exact version to try and reproduce their problem.
- The version numbers auto-increment, so you don’t have to remember to change 1.9.14 to 1.9.15.
- This is better than having version numbers based on build date – if you build revision 1473 today, it should be exactly the same as when you built revision 1473 three months ago, not have a different version number.
See the download and setup instructions
and the list of file tokens
Development & Contributing
See the development