Use Subversion revision number as version number with MSBuild

(And handle revision numbers larger than 65534)

When using a system for continuous integration to automatically deploy your application, it is important to know what version of your code is deployed. This tutorial will show you how to automatically set the version number of the deployed .dll.

In a .NET project, the version number is defined in AssemblyInfo.cs, on the format 1.0.0.0. The numbers are MajorVersion.MinorVersion.Build.Revision. The two latter, build and revision numbers, should be set automatically by your CI system on each deploy.

Content of this tutorial

  • How to create an MSBuild target to automatically insert the revision number on build
  • What to do when your revision numbers are too large to use as .NET revision numbers
  • How to use Bamboo to get the latest revision number from Subversion and use this as an input parameter to MSBuild

Continue reading “Use Subversion revision number as version number with MSBuild”