Incrementing Workspace Build Versions | CodeGuru

Incrementing Workspace Build Versions

Environment: VC6 The problem… I develop several multi-project applications and have always had trouble keeping up with all my changes. Typically, I create several “release” builds while I am developing, so I can test as I go. Then I create a complete build of all modules for my clients. This is the only time I […]

Written By
CodeGuru Staff
CodeGuru Staff
May 31, 2001
2 minute read
CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More

Environment: VC6

The problem…

I develop several multi-project applications and have always had trouble keeping up with all my changes.

Typically, I create several “release” builds while I am developing, so I can test as I go. Then I create a complete build of all modules for my clients. This is the only time I really care to increment the build number.

In the past I have created a separate resource file with my build number (similar to the Microsoft solution in the MSDN library). But whenever the resource file changes, visual studio doesn’t keep the changes to the .RC file.


So enter a better solution(?)…

This simple program will ready your workspace files and check all the projects it contains. Each project is checked for changes, since the last time it was run. If a project changes, then anything dependent on it will also be changed.

The picture above shows a workspace with 2 projects (Play1 & Play2). Play1 is dependent on Project2. One file changed (see the ‘**’ by Play2.cpp) in Pay2 (see the ‘**’ by Play2.dsp), so the build number was incremented for Play1 and Play2 (see the ‘**’ by both projects).

How it works…

When versions are incremented, a file is added with the name of the project file and the extension of “absVersion”. This file contains the last build number used and is dated with the date of the last build (this is used to check for changes).



Script segment from the Microsoft Developer Studio generated resource script:

//
// Version
//
VS_VERSION_INFO VERSIONINFO
 FILEVERSION 1,0,0,8 <<— This will be incremented when
                              dependencies have changed.
 PRODUCTVERSION 1,0,0,8 <<— This will be incremented when
                              dependencies have changed.
 FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
 FILEFLAGS 0x1L
#else
 FILEFLAGS 0x0L
#endif
 FILEOS 0x4L
 FILETYPE 0x1L
 FILESUBTYPE 0x0L
BEGIN
    BLOCK “StringFileInfo”
    BEGIN
        BLOCK “040904b0”
        BEGIN
            VALUE “Comments”, “\0VALUE “CompanyName”, “Automated Business Soultions, Inc.\0VALUE “FileDescription”, “absBuildIncrement MFC Application\0VALUE “FileVersion”, “1, 0, 0, 8\0” <<— This will be
                     incremented when dependencies have changed.
            VALUE “InternalName”, “absBuildIncrement\0VALUE “LegalCopyright”, “Copyright (C) 2001\0VALUE “LegalTrademarks”, “\0VALUE “OriginalFilename”, “absBuildIncrement.EXE\0VALUE “PrivateBuild”, “\0VALUE “ProductName”, “absBuildIncrement Application\0VALUE “ProductVersion”, “1, 0, 0, 8\0” <<— This will be
                     incremented when dependencies have changed.
            VALUE “SpecialBuild”, “\0END
    END
    BLOCK “VarFileInfo”
    BEGIN
        VALUE “Translation”, 0x409, 1200
    END
END

Downloads

Download demo project – 12 Kb


Download source – 54 Kb

CodeGuru Logo

CodeGuru covers topics related to Microsoft-related software development, mobile development, database management, and web application programming. In addition to tutorials and how-tos that teach programmers how to code in Microsoft-related languages and frameworks like C# and .Net, we also publish articles on software development tools, the latest in developer news, and advice for project managers. Cloud services such as Microsoft Azure and database options including SQL Server and MSSQL are also frequently covered.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.