Thursday, January 30, 2014

Visual Studio does not auto-increment assembly build numbers / ProductVersion / AssemblyVersion / AssemblyInfo

I wanted Visual Studio to auto-increment the version number of my assembly for every build.
In AssemblyInfo.cs I changed this line to be:
[assembly: AssemblyVersion("1.0.0.*")]
but then my Assembly ProductVersion was "1.0.0.*"

How-I-fixed-it:
I commented out the line
//[assembly: AssemblyFileVersion("1.0.0.*")]
in AssemblyInfo.cs.
My version number was then like expected  e.g. "1.0.0.123456" and was incremented every time i changed my code and re-built the project.

I found the right hints here: http://razorleaf.com/2010/01/auto-incrementing-visual-studio

Citing Paul Luc:
While it’s true that you can edit assembly version information via the IDE, you must first remove the AssemblyFileVersion attribute from the AssemblyInfo.cs file in order for Visual Studio to apply auto-incrementing. Simply clearing the field values for the assembly file version via the IDE will result in a format-related exception.




No comments:

Post a Comment