Click here to Skip to main content
12,633,732 members (30,746 online)
Click here to Skip to main content
Add your own
alternative version


132 bookmarked

Increment File and Product Version Number - Multiple IDE

, 21 Oct 2008 CPOL
Rate this:
Please Sign up or sign in to vote.
An add-in to automatically increment the FileVersion and ProductVersion fields in your application's resource file. Works in VC6 and VS2005, and probably all versions in between.


This add-in replaces the add-in I provided a few years ago for use with Visual Studio 6. The previous add-in was based on an article by Mihai Filimon 'Increment Private Build Number'. This new add-in uses the core code of the previous add-in to increment the file and product versions in the rc and/or rc2 resource files. I have enhanced things slightly:

  • Multi-IDE compatible. I have verified that it works in VC6, VC7.1 (VS2003), VC8 (VS2005) and VC9 (VS2008). I would imagine that it works for VC7.0 (VS2002). The installer registers the add-in for use by VC6, VC7.0, VC7.1, VC8, and VC9. It kind of works in VC9 although some users have reported problems:
    1. If the VERSIONINFO block is in the .rc file, then VC9 reports that the resources have been changed externally, and do you wish to reload. Saying yes causes VC9 to crash. I have verified this, and very quickly moved my VERSIONINFO block(s) to the .rc2 file. I think this is a problem in VC9 and not my add-in :).
    2. Manual increment works, but auto-increment does not — I have tested projects where the VERSIONINFO block is in the .rc2 file and it works for me. (This should now work because I have fixed the CBuildEventsSink class implementation of the EnvDTE::_dispBuildEvents interface.)

    I would appreciate any feedback from users of VC7.0 as I have not tested it in this IDE.

  • The file and product versions are made up of four groups of numbers — the major version, minor version, revision, and build number. (Some people may name these differently — but the concept is important here, not the naming convention. What's in a name, after all?) Anyway, the previous release of the add-in was restricted to incrementing the last number in this group. This new add-in allows you to choose which number to increment.
  • Added the option to enable/disable the add-in.
  • Added the option to only increment the version of the StartUp project. This is not applicable to VC6 as the add-in only increments the Active project anyway.
  • Added the option to increment the version even if there were build errors. The default is to not increment.
  • If you choose to increment the major version, minor version, or revision, you are given the option to 'reset' the lower numbers to their starting values. E.g., if you choose to increment the minor version, you may choose to reset the lower digits so that the revision is reset to 0 and the build number is reset to 1.
  • If you have chosen to increment the major version, minor version, or revision, you may also choose, after one increment, to revert to auto-incrementing the build number.
  • I have also added in the PrivateBuild and SpecialBuild entries of the version block, which will be incremented similar to the ProductVersion and FileVersion entries.
  • I have added options to increment all or none of these four fields, or any combination in between.


Having migrated from VC6 to VC8 (and now VC9), I was disappointed to see that my original IncVersion add-in, which had served me for nigh on 4 years, was not compatible with VC8. I tried to find a replacement, but none was really forthcoming, and suffered minor niggles etc. So, I decided to to code it myself.

I was very fortunate to stumble upon a most excellent article by sp1ff, Common Add-Ins. Great! Now, I could update my add-in and it will work in both my IDEs. After a bit of jiggery-pokery, I present to you my new, multi-IDE, slightly improved add-in. I say multi-IDE. I have obviously tried it on the two versions of Visual Studio that I have, VC6 and VC8. But due to the excellence of sp1ff's article, I have no doubt it will work for all versions in between. Unless I've messed up somewhere. (Note that most of the code is sp1ff's, and all his source files contain the required comment block to reflect this.)

Using the Add-In


I have included a setup.exe which, when run, will install the add-in DLL and its satellite UI DLL in a directory of your choosing. The second part of the install makes the required registry modifications to 'register' the add-in with VC6, VC7.0, VC7.1, VC8, and VC9.

Uninstallation will remove the DLLs and clean up the registry.


The add-in features a toolbar with two buttons. One to perform a manual version increment, the other to configure which number in the version group to increment.

Toolbar in VC6

IncVersion in VC6

Toolbar in VC8

IncVersion in VC8

Probably, more usefully, the selected version number is also automatically incremented every time the project/solution is built. For VC6, this is only the active project. For VC8, it is the active project with all its dependencies.

Note: When performing a manual increment using the toolbar Increment button, only the active project's version number is incremented. This is true for both VC6 and VC8.

Note: For both versions, the version number is incremented whether the source files have changed or not. Depending on the chosen option, if there are any errors in a project compile, the number which was incremented is reverted back to its original value.

Why increment first then if there were build errors? The increment function is called when the build is started and not when the build is completed, so that the new version number is compiled into the resulting object. Depending on the chosen option, any errors which may occur will cause the number to be decremented again.

This updated add-in parses the project file (.dsp/.vcproj) of the project(s) being incremented for all the .rc and .rc2 files it specifies. It is not therefore limited to .rc and .rc2 files having to reside in the project directory or its /res sub-directory. It will disregard any non-C++ projects not having the .dsp/.vcproj project filename extension.


  • If no resource files are found for a project, a warning message is displayed. This can be switched off, if desired.
  • If doing a manual increment using the toolbar Increment button, a message box is displayed.
  • If the increment occurs as part of a project compilation, the warning is written to the Output window of Visual Studio.
  • For VC6, this is on the Macro tab of the Output window. For VC8, this is in the IncVersion pane of the Output window.
  • A similar warning is displayed if one or more .rc/.rc2 files are found but none contain a VERSIONINFO block.

VC6 - no resource files found warning message

VC6 - no resource files found warning message

VC6 - no VERSIONINFO block found warning on the Macro tab of the Output window

VC6 - no VERSIONINFO block found warning on the Macro tab of the Output window

VC8 - no VERSIONINFO block found warning message

VC8 - no VERSIONINFO block found warning message

VC8 - no VERSIONINFO block found warnings and no resource files found warning in the IncVersion pane of the Output window

VC8 - no VERSIONINFO block found warnings and no resource files found warning in the IncVersion pane of the Output window

If the file or product version contains an asterisk character '*' in place of the number that is about to be incremented, the number is reset to 1 after IncVersion does its stuff.

IncVersion is able to increment multiple version blocks in both the .rc and .rc2 files at the same time (even if they are commented out!). And, there can be multiple language entries in a version block. All will be incremented.

The numbers in a version group are separated by a comma or a full-stop (a period in U.S. parlance). IncVersion is able to cope with one and/or the other in a single entry for file or product version, and can also cope with a mixture of these delimiters in the same group.


VALUE "FileVersion", "4, 3, 1, 409\0"

VALUE "ProductVersion", "4. 3. 1. 409\0"

is okay.

VALUE "FileVersion", "4. 3, 1, 409\0"
VALUE "ProductVersion", "4. 3, 1. 409\0"

is okay too!

Finally, it doesn't matter about spaces between the digit groups, they are ignored. So FILEVERSION 4,3,1,409 is the same as FILEVERSION 4, 3,1 ,409.


The add-in incrementing can be turned off by unchecking the 'Enable' checkbox.

By default incrementing is done if there were no builds errors. The option can be set to increment no matter what the build outcome by unchecking the 'Don't Increment If Build Errors' checkbox.

For VC7 onwards, you can choose to increment the version of all of the projects in the Active Configuration. Or to only increment the version of the StartUp project, check the 'Active/Startup Project Only' checkbox.

For all IDEs, you can select which version fields to increment — FileVersion, ProductVersion, PrivateBuild, and/or SpecialBuild.

You can change which number is incremented by clicking the Configuration button. A new dialog appears in VC6, the Options dialog appears in VC8.


Options in VC6


Options in VC8

Here, the add-in is enabled, all projects in the Active Configuration will be incremented, only projects with no build errors will be incremented, all four version fields are selected for incrementing, and the build number is selected for incrementing.

If a different digit is chosen, then you are presented with two more options.


More options in VC6


More options in VC8

Here, the VC6 add-in is configured to increment the major version once, and then to revert incrementing the build number. The VC8 add-in is configured to increment the minor version, resetting the revision (back to 0) and the build number (to start again at 1). It will also revert to incrementing the build number once the minor version has been incremented. It has also been configured to only increment the FileVersion and ProductVersion fields, and only the Active/Startup project.

Both IDEs have been configured to increment the version even if there were build errors in any of the projects.

If the 'Revert' check-box is left unticked, the add-in will continue to increment the last chosen digit. In our examples, the VC6 add-in would continue to increment the major version, and the VC8 add-in would continue to increment the minor version.

The last 'Display Warnings' check box determines whether or not a message is displayed (via a message box or to the Output window.) Untick it if you do not wish to see these warnings.

The Installer

This add-in is deployed using Jordan Russell's excellent Inno Setup. VC8 lacks a dedicated add-in deployment wizard, and I couldn't be bothered to work out what went where etc. So, I went for an approach I am very familiar with, and deployed the two DLLs using Inno setup. The second half of the install script then runs the various rgs files to register the add-in for the different IDEs. Uninstallation removes the DLLs and cleans up the registry. ;)


Since I have not tested this on VC7.0, I would be very interested to know whether it does actually work in that IDE.

Of course, if you encounter any problems, then please post a message.


  • 11 March 2008. New article submitted with IncVersion for VC6 and VC8 (tested on both).
  • 18 March 2008. Updated article to reflect new requests/functionality.
  • 19 March 2008. Updated to only increment C++ projects. Options to switch off warning messages.
  • 28 March 2008. Fix for VC7 onwards to take account of the '>' character at the end of rc/rc2 filenames in vcproj files.
  • 25 April 2008. Added incrementing of PrivateBuild and SpecialBuild. Added options to disable incrementing totally, to only increment the version of the Active/Startup Project (not relevant for VC6), and the ability to choose whether to increment FileVersion, ProductVersion, PrivateBuild, and/or SpecialBuild.
  • 2 May 2008. VC8/9 Options - automatically selects the Increment Version Add-in options entry in IDE's Tools->Options dialog. VC8 and VC9 source code solutions. Sorry, no VC7/7.1. And, obviously, no VC6 (as this has VC7+ code in it which would not compile on VC6 anyway).
  • 24 May 2008. Fixed issue for some users where the manual increment was working but the automatic increment was not. I would like to thank Josemi Antelo for helping me trace this issue. Added option to allow incrementing to be done even if there were project build errors.
  • 10 June 2008. Fix to allow for spaces within project names. Thanks go to Kevanmc for pointing this out and providing the fix.
  • 23 June 2008. Fixed uninstaller so that Toolbar is removed from various IDEs.
  • 21 July 2008. Fixed VC6 install to puts dll’s in \Program Files\Microsoft Visual Studio\Common\MSDev98\AddIns directory. This should fix the problem with the two buttons not doing anything when pressed.
  • 25 July 2008. Fixed VC6 (and probably all IDEs) to allow for multi-byte character project pathnames. My sincere thanks go to Haerim Lee for first identifying the problem and helping me to test a fix.</a />
  • 13 September 2008. Only increment for Build/RebuildAll events, not for Clean. Thanks to I'm Pear for finding this bug.
  • 20 October 2008. Fixed situation where if you edit your resources in some way, compile and there are errors, the resource edits are lost. I have changed the internal logic so that version incrementing is done AFTER the project build has finished. Thanks again to Haerim Lee for finding this bug.

Outstanding Issues

What with trying to support so many IDEs all at once, and the more people make use of the add-in, the more minor (and some major!) bugs become apparent.

The following is a list of outstanding bugs that I am aware of, as well as any requested enhancements that I am considering/working on.

  • Assembly file incrementing — for support for managed C++, C#, VB, and J#.
  • Only increment version number if the source in a project has changed.
  • Silence the .rc reload message. (Quite a popular one this, and I can understand why.)
  • Only increment version number if the source in a project has changed.
  • Increment all projects whose source has changed in a solution/workspace when doing command line build, or when clicking increment button — not just the active project like it does now — subject to the 'Active/Startup Project Only setting.
  • Build configuration choices to decide whether to increment only debug or release, or any combination.
  • SourceSafe integration - 'nuff said!


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Jordan Walters
Software Developer (Senior)
United Kingdom United Kingdom
Ok, it's about time I updated this profile. I still live near 'Beastly' Eastleigh in Hampshire, England. However I have recently been granted a permamant migration visa to Australia - so if you're a potential employer from down under and like the look of me, please get in touch.
Still married - just, still with just a son and daughter. But they are now 8 and 7 resp and when together they have the energy of a nuclear bomb.
I worked at Teleca UK for over 8.5 years (but have now moved to TikitTFB) and have done loads of different things. Heavily involved with MFC, SQL, C#, The latest is ASP.NET with C# and Javascript. Moving away from Trolltech Qt3 and 4.

You may also be interested in...

Comments and Discussions

QuestionI find a addin support VS2010. Pin
Alberl15-May-13 19:01
memberAlberl15-May-13 19:01 
QuestionTrying to do VC10 myself - not there (yet) Pin
Butler Institute22-Aug-11 7:05
memberButler Institute22-Aug-11 7:05 
Hmmm, not sure if anyone else is reading this .....

I've started looking at updating IncVersion for VC10 and not really getting there.

I thought maybe I could just change the installer, adding some registry tweaks for VC10. That sort of worked. I just copied vs2008.rgs to vs2010.rgs, changed 9.0 to 10.0, and tried to build it.

That failed as I hadn't rebuilt either of the dlls, which get built into Release.
I tried to build them (see later) but that failed.
So I copied them from my installation of IncVersion, and tried again.
That gave me a working installer.
It installed IncVersion satisfactorily from VC6's point of view, ie it worked.
(The only other one I have is VC10)
From VC10's point of view I get partly there. I get the toolbar item, and the configuration panel.
However, rather more importantly it doesn't actually work. That's to say it doesn't increment anything.

When I try to rebuild the dlls (in VC10) I seem to get IncVersionUI built ok, but IncVersion needs two things which I haven't got - actually one thing I haven't got and another which I have but isn't configured to be found.

1. What's JLogging ? It looks like its needed but it's not in the source zip.
2. ObjModel\ADDAUTO.H is required by stdafx.h. I can see that it's actually a VC6 file, and I do have VC6, so I do have it. Please advise whether it is actually necessary or whether the path to it should be added to the project settings. I presume that since it isn't there already previous builders have had it in their Global Visual Studio settings instead.

Further questions ...

3. If I'm rebuilding it under VC10 I should create a Test_App for it. Would you recommend just copying TestVC9 and renaming everything (including generating new GUIDs) and letting the Convertor convert it to proper VC10 vcxproj files, or creating a new poject from scratch ? If the latter, which I presume would be better, what Project settings would you use ? Please note that I am new to VC10 - indeed to any version later than VC6 and have no experience of MFC, or ATL.

Well, that was rather a lot....
Alternatively, maybe someone who is already familiar with both IncVersion and VC10 add-ins could sort out the VC10 issues.

AnswerRe: Trying to do VC10 myself - not there (yet) Pin
Jordan Walters22-Aug-11 9:33
memberJordan Walters22-Aug-11 9:33 
GeneralRe: Trying to do VC10 myself - not there (yet) Pin
Butler Institute24-Aug-11 0:49
memberButler Institute24-Aug-11 0:49 
GeneralRe: Trying to do VC10 myself - not there (yet) Pin
Butler Institute30-Jan-12 5:24
memberButler Institute30-Jan-12 5:24 
GeneralRe: Trying to do VC10 myself - not there (yet) Pin
Jordan Walters30-Jan-12 7:55
memberJordan Walters30-Jan-12 7:55 
GeneralRe: Trying to do VC10 myself - not there (yet) Pin
Butler Institute29-Feb-12 7:10
memberButler Institute29-Feb-12 7:10 
GeneralRe: Trying to do VC10 myself - not there (yet) Pin
Synetech17-Aug-12 9:33
memberSynetech17-Aug-12 9:33 
GeneralRe: Trying to do VC10 myself - not there (yet) Pin
Jordan Walters17-Aug-12 11:22
memberJordan Walters17-Aug-12 11:22 
QuestionIncVersion for VS2010 ? Pin
Butler Institute29-Jul-11 3:50
memberButler Institute29-Jul-11 3:50 
AnswerRe: IncVersion for VS2010 ? Pin
Butler Institute19-Aug-11 4:53
memberButler Institute19-Aug-11 4:53 
GeneralDebug & Release Builds Pin
codevisio10-Apr-11 22:17
membercodevisio10-Apr-11 22:17 
GeneralFeature request: Install for all users Pin
M.Oerder15-Jun-09 1:03
memberM.Oerder15-Jun-09 1:03 
GeneralRe: Feature request: Install for all users Pin
shiyouc19-Jan-10 18:47
membershiyouc19-Jan-10 18:47 
QuestionHow can I supress message "The file has been modified..." in VS9? Pin
Nikotin3321-Jan-09 23:12
memberNikotin3321-Jan-09 23:12 
AnswerRe: How can I supress message "The file has been modified..." in VS9? Pin
WH Tan3-Feb-09 20:16
memberWH Tan3-Feb-09 20:16 
QuestionYour solution and SourceSafe ? ? ? Pin
jtabakelis13-Nov-08 6:16
memberjtabakelis13-Nov-08 6:16 
GeneralIssues with VC6/VC9 Pin
Member 2081924-Nov-08 8:39
memberMember 2081924-Nov-08 8:39 
AnswerRe: Issues with VC6/VC9 Pin
Jordan Walters4-Nov-08 9:22
memberJordan Walters4-Nov-08 9:22 
QuestionDoes not find my RC & RC2 files to update . . . Pin
jtabakelis29-Oct-08 5:49
memberjtabakelis29-Oct-08 5:49 
QuestionCan not build your solution Pin
jtabakelis29-Oct-08 5:36
memberjtabakelis29-Oct-08 5:36 
AnswerRe: Can not build your solution Pin
Jordan Walters29-Oct-08 12:37
memberJordan Walters29-Oct-08 12:37 
QuestionRe: Can not build your solution Pin
jtabakelis30-Oct-08 5:12
memberjtabakelis30-Oct-08 5:12 
AnswerRe: Can not build your solution Pin
Jordan Walters30-Oct-08 13:50
memberJordan Walters30-Oct-08 13:50 
QuestionRe: Can not build your solution Pin
jtabakelis31-Oct-08 5:20
memberjtabakelis31-Oct-08 5:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.161208.2 | Last Updated 21 Oct 2008
Article Copyright 2008 by Jordan Walters
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid