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'
- Download and extract Versioner.exe from the ZIP archive to the project directory where you want to enable the auto-increment feature.
- Right click on the project in Visual C# 2005 Express Edition and choose Properties.
- Click Build Events.
- 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
One small note... i've noticed that if the project location and/or the Versioner.exe is located in a directory with spaces you should use " in order to run properly. e.g.: "$(ProjectDir)Versioner.exe" "$(ProjectDir)Properties\AssemblyInfo.cs".
ReplyDeleteOther thing... I have a solution with many projects so instead of copying the versioner.exe to all projects root I used the project solution for the versioner location. e.g: "$(SolutionDir)Versioner.exe" "$(ProjectDir)Properties\AssemblyInfo.cs".