Version Manager is a COM Add-in for Visual C++ .NET written in C++.  Its job is to increment the version number of the application being developed by one on each build (best known as the application's build number).  This add-in searches the project for an .rc file, and it if it finds one, it parses the .rc file to find the version information token(s), and increments the build count by one, and saves the file, and allows the compiler to proceed in compiling the application.

To use it, you should first build the project file which can be downloaded at the bottom of this article to generate the add-in's DLL and register it, so that it's accessible by Visual C++ .NET.  The next time you start your IDE, Version Manager automatically loads, and increments the build count before each build in a quite transparent manner to you.  To disable it, use the Add-in Manager dialog in Visual C++ .NET, accessible from Tools | Add-in Manager menu item.  Needless to say, if the project is not a Visual C++ project, or if it doesn't have an .rc file, Version Manager will not do anything.

Version Manager is unlikely to corrupt the resource file (I haven't met any such situation even during the development of this add-in, and I use it all the time, but can't guarantee that it won't happen for you).  Just in case the resource file is corrupted for whatever reason, this tool automatically generates backup files with the same name and extension as the resource file by appending extensions of .backup1, .backup2, .backup3, where .backup1 file is the most recent backup, and .backup3 is the oldest backup file.

Bug Fixes

2004, Oct 10
Howard Swinehart [support AT binaryboy DOT com] found a serious bug in Version Manager, which resulted in an empty resource file if it does not include a version resource block. Luckily, of course, Version Manager makes a backup of the resource script before modifying it, but at any rate, this was a serious bug. Howard himself was willing to supply a patch that fixed the bug. I have verified his patch, and it's working correctly. The latest version of Version Manager, which includes this patch, can be downloaded at the bottom of this article, thanks to Howard! The latest version is 1.0.0.154. If you are using version 1.0.0.153 or an older version, upgrade immediately.

What's New

The current version of Version Manager support Microsoft Visual Studio .NET 2003, as well as Microsoft Visual Studio .NET 2002.  For the Microsoft Visual Studio .NET 2003 project, open the VersionManager2003.sln file inside the ZIP package at the bottom of this article.

Known issues

Version manager will fail to update the version information in the .rc file if the .rc file is checked in the source control manager (if you use one).  This is not an issue, in my opinion, because if you have a file checked in, it means that you don't wish it to be changed under your nose, however, you must know this.

Other than this, I don't know of any issue in Version Manager, but the general “use it at your own risk” terms apply to it, and after all you have the source code available for studying/changing anything.

Limitations

Currently, Version Manager only supports C++ projects in Visual Studio .NET, and I plan on extending it to handle Visual C#, Visual J#, and Visual Basic .NET projects as well.  You can see this clearly in the source code.  However, when I find enough time to do this is unknown to me, and I would be happy to know if someone adds support for those environments as well.  If you do, please contact me, and I will include the updated version in this article mentioning your name.

Enjoy auto version incrementing!

 Download source code for the article

This article originally appeared on BeginThread.com. It's been republished here, and may contain modifications from the original article.