.

« SQL Server Everywhere Edition Requirements | Main | Contest Deadline for FeedJournal »

Friday, August 04, 2006

HOWTO: Auto-Increment the Version in Visual C# Express

One of the features that I miss the most when I am working in Visual C# 2005 Express Edition is the possibility to auto-increment the version number for each build. Below, I will explain how to get around the limitation and add this functionality to the stripped down Express Edition of Microsoft's Visual Studio development environment.

The solution comes from CodeProject user PIEBALDconsult's Versioner project. His C# class increases the revision number of the AssemblyVersion, given the path to the file where it resides (typically AssemblyInfo.cs). Since PIEBALDconsult only provides the source code I took the liberty of compiling it into a .NET 2.0 executable, which can be downloaded from here (ZIP). The steps necessary for enabling auto-increment are listed below:

  1. Download and extract Versioner.exe from the ZIP archive to the project directory where you want to enable the auto-increment feature.
  2. Right click on the project in Visual C# 2005 Express Edition and choose Properties.
  3. Click Build Events.
  4. In the text box where it says Pre-build event command line enter:
$(ProjectDir)Versioner.exe $(ProjectDir)Properties\AssemblyInfo.cs        

Now, each time you compile the project, the AssemblyVersion's revision will increase by one.

Posted by Jonas Martinsson at 17:22
Categories:
|

© Jonas Martinsson 1995-2006