Wednesday, July 29, 2009

How to fix AssemblyVersion number but auto-increment AssemplyFileVersion number

Why need it?

A quote from Microsoft (http://support.microsoft.com/kb/556041):

If you release new version of assembly very frequently, say once every day, and if assemblies are strong named, Developers will have to change the reference every time you release new assembly. This can be quite cumbersome and may lead to wrong references also.
But unfortunately that link doesn't show how to make AssemblyFileVersion auto-increment as we do need a version control feature, so i started to search around over internet and finally found a solution (well.. not quite nice)


Solution

1. Download and install the AssemblyInfoTask package, you can find it from here
http://code.msdn.microsoft.com/AssemblyInfoTaskvers/Release/ProjectReleases.aspx?ReleaseId=232

2. Reboot your PC after installation (I know ... but trust me, it's needed)

3. Then you should be able to find a help chm file here
C:\Program Files\MSBuild\Microsoft\AssemblyInfoTask\AssemblyInfoTask.chm

4. Open it and follow what it suggests in "Getting Started" page

5. You can modify the Microsoft.VersionNumber.targets file to customize the format of version number based on your need

P.S it doesn't support TEAM FOUNDATION or Source Safe quite well, as you will get an access error when you build the project if the AssemblyInfo source file is locked (read-only)

Hope it helps someone

Labels: , ,

0 Comments:

Post a Comment

<< Home