This freeware is inspired by a tool by Srinivas Vaithianathan hosted by CodeProject too: Versioning of executables at build time. I completely modified it and now there isn't any code remaining from it.
Since several years now, I'm using a great open source tool named ClassBuilder. This tool is provided by Jimmy Venema and can be found at SourceForge.
From Sourceforge project page:
ClassBuilder is a freeware CASE tool targeted at the C++ developer, running on Win95/98/NT. It lets you create, manipulate and navigate classes, class relations, class members and class methods at a high level of abstraction through a graphical user interface.
ClassBuilder generates two files for each class (one *.cpp and one *.h) and a Master Header File for the whole data model. The Master Header File includes all the classes' headers, defines the
typedefs,... This file also contains some symbolic constants which are automatically updated when you generate the sources. According to a data model named model, the Master Header File model.h will contain:
#define MODEL_DATE 20030211
#define MODEL_TIME 193311
#define MODEL_VERSION 12
Each time you change the interface, ClassBuilder increments
MODEL_VERSION and updates
Compiling the data model as executable or DLL
To use the data model, you should compile it as a static lib, an executable or a DLL. In case of exe or DLL, the Visual Studio generates a *.rc file. This file contains GUI definitions, icons, cursors, bitmaps... It should also contain the version information of the binary.
Here is the fragment of code in a Windows Resource File which describes the version information for RCVersion itself.
FILEVERSION 1, 0, 0, 100
PRODUCTVERSION 1, 0, 0, 1
VALUE "Comments", "Modified by BZCToOn's"
VALUE "CompanyName", "Syntheretix"
VALUE "FileDescription", "rcversion MFC Application"
VALUE "FileVersion", "1, 0, 0, 100"
VALUE "InternalName", "rcversion"
VALUE "LegalCopyright", "Copyleft (C) Bzc ToOn'S 2002"
VALUE "OriginalFilename", "rcversion.EXE"
VALUE "PrivateBuild", "RCVERSION-20030212_100"
VALUE "ProductName", "rcversion Application"
VALUE "ProductVersion", "1, 0, 0, 1"
VALUE "Translation", 0x409, 1200
What RCVersion does?
RCVersion parses both the Master Header File and the Resources File. Next, according to the information contained in these two files, it generates a file named version.h and updates the Resources File.
Here is the output file produced by RCVersion for itself.
#define __SNAPSHOT__ "20030213-020246"
#define __FILEVERSION__ "22.214.171.124"
#define __PRODUCTVERSION__ "126.96.36.199"
#define __COMPANY__ "Syntheretix"
#define __PRODUCT__ "rcversion Application"
#define __DESCRIPTION__ "rcversion MFC Application"
#define __PRIVATEBUILD__ "RCVERSION-20030212_100"
#define __COPYRIGHT__ "Copyleft (C) Bzc ToOn'S 2002"
#define __CB_DATE__ "20030212"
#define __CB_TIME__ "190244"
#define __CB_VERSION__ "100"
Command line execution
rcversion [-q] [-i input]
-q quiet: don't show the UI. Usefull for Custom Build Step in Visual Studio.
-i input: specify the input file. The input file could be *.rc or *.h.
The filename without extension will be used as data model name.
How to use RCVersion with Visual Studio
- Add a file to the project: version.h
- Define Custom Build Step
- Command Line: rcversion -q -i $(TargetName)
- Description: RCVersion
- Output: version.h
- Dependencies: $(TargetName).h
- You can now put
#include 'version.h' in $(TargetName).h or in stdafx.h.
Don't forget to put RCVERSION in path
To set Visual Studio executable path to the directory where RCVERSION is installed
- Version number extraction from Classbuilder Master Header File
- RC File version information editor
- version.h generation
- Optional RC file update
- Backup of your old version.h and RC files
- Preview of version.h and RC files
- Edition of version.h and RC files (through Notepad )
- Non interactive execution
Bugs & limitation
I only tested RCVersion on my own projects. For me, it runs fine. I hope for you too .
- version.h: Added
#ifdef _DEBUG / #endif
- version.h: better formatting
- Added new field 'Symbols Prefix' to the symbolic constants
- Added new command line option
-p prefix to set the symbols prefix
- Preview control is now a
RichEdit one to support fixed width font
- RC File parsing: If a control ID contains one of the
VERSIONINFO directive (
PRODUCTVERSION), the whole line is replaced and the whole RC File is corrupted.