Showing posts with label file version. Show all posts
Showing posts with label file version. Show all posts

Wednesday, December 12, 2012

Automatically Increment Version number for Assembly

I have to look this up every time I do it, so I am posting this link to make it easier to find.


http://www.csharpcity.com/2012/visual-studio-automatic-version-numbering/



To summarize, you have to change the C# assemblyinfo.cs file from:

[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]


to just:

[assembly: AssemblyVersion("1.0.*")]
 
 
The AssemblyFileVersion entry must not be present. 
 
The version only increments when the project is opened, so it may appear that the version does not increment.
 
 
For VB.NET it is similar.   Edit the assemblyInfo.vb file and change:
 
 
 
 
 
to:
 
  


The GUI for Assembly Version does not let you make this change.

Wednesday, June 22, 2011

Auto-Incrementing Assembly and File version in Visual Studio

I made a post on this topic some time ago. I still find it incredible that Visual Studio (2005, 2008, 2010) doesn't provide a way to automatically increment the File Version number in an Assembly. Why is this important? To me, the Setup and Deployment project will not deliver a file if the file version is the same (even if the file is newer, different, etc.). It is very easy to forget to go manually update the assembly's File Version, and you don't find out about it until your users install the updated application and see no difference.

The method I posted before works fine, but it is a little complicated to setup and get going.

The new method I found is much easier to setup and use:

http://autobuildversion.codeplex.com/

Saturday, September 6, 2008

Incrementing FileVersion for VC++

In a recent posting, I talked about solutions to incrementing the FileVersion in Visual Studio .NET for VB.NET and C# project. This need was motivated by the changes in VS2008 that requires a FileVersion to be changed before the Windows Installer will replace a file.

Some of my projects have Native DLLs that are compiled in VS 2008's VC++ compiler. These files has the same problem with the installer, yet the previous solution (http://dotnetref.blogspot.com/2008/09/auto-incrementing-file-version-in.html) did not address.

I found this very handy Add-In that works well with VS2008 (and previous versions) that will increment the FileVersion (Product Version, etc.) in the VC++ projects resource file.

http://www.codeguru.com/cpp/v-s/devstudio_macros/visualstudionet/article.php/c14981

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