Thursday, September 4, 2008

Auto-Incrementing the File Version in Visual Studio 2005 and 2008

*** Update - Since I made this post, I have found another tool that is simpler to use and also work with VS2010. See this http://autobuildversion.codeplex.com/

If this doesn't work for you, then you may with to view the info below:

The Setup and Deployment (Windows Installer) has a significant change between VS2005 and VS2008. In VS2008, a file will not be updated by the installer if the File Version has not changed. This pretty much breaks all of the VS2005 Installations I have created. There are various reasons for this, and I will let you read for yourself:

http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.vstudio.general&tid=c4c56abf-9bde-45ed-8737-90cf90514d89&cat=&lang=&cr=&sloc=&p=1

The solution to the problem is to increment the File Version (under Project Properties/Assembly Information) between Setup (.msi) builds. So, before every setup you create, you have to go manually update the File Version so the setup will update the file. Before, you just had to update the Version property in the Installer Project (and let it update the Product Code); you still have to do this (which is probably acceptable). I thought there must be someway to automatically increment the File Version since this change to the Installer breaks all of my setups; however, there is not (that I can find anyway). The only workable solution I have found is to use a BuildTask that updates the AssemblyInfo.vb (or AssemblyInfo.cs) before each build is made. This solution is a really complicated for something that was a checkbox in VB6 (as someone pointed out).

Here is the solution I tried and it does work:

http://www.codeproject.com/KB/dotnet/Auto_Increment_Version.aspx

Here is a similar solution:

http://weblogs.asp.net/bradleyb/archive/2005/12/02/432150.aspx

1 comment:

Anonymous said...

Not being overly familiar with Visual Studio I found updating the File Version a PITA. Thanks for pointing me to the correct area to a least manually update this information. I got side tracked by the Deployment Project Version number.