Click here to Skip to main content
15,892,517 members
Articles / Desktop Programming / ATL

Increment File and Product Version Number - Multiple IDE

Rate me:
Please Sign up or sign in to vote.
4.58/5 (32 votes)
21 Oct 2008CPOL12 min read 293.2K   1.2K   134  
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.
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"

#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "winres.h"

/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS

/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32

#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//

1 TEXTINCLUDE 
BEGIN
    "resource.h\0"
END

2 TEXTINCLUDE 
BEGIN
    "#include ""winres.h""\r\n"
    "\0"
END

3 TEXTINCLUDE 
BEGIN
    "1 TYPELIB ""IncVersion.tlb""\r\n"
    "\0"
END

#endif    // APSTUDIO_INVOKED

#endif    // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////


/////////////////////////////////////////////////////////////////////////////
// English (U.K.) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
#pragma code_page(1252)
#endif //_WIN32

/////////////////////////////////////////////////////////////////////////////
//
// REGISTRY
//

IDR_INCVERSION          REGISTRY                "res\\IncVersion.rgs"
IDR_DEVSTUDIO           REGISTRY                "res\\DevStudio.rgs"
IDR_ADDIN               REGISTRY                "res\\AddIn.rgs"
IDR_VS2003              REGISTRY                "res\\vs2003.rgs"
IDR_VS2005              REGISTRY                "res\\vs2005.rgs"
IDR_VS2008              REGISTRY                "res\\vs2008.rgs"
IDR_PROPPAGE            REGISTRY                "res\\PropPage.rgs"
IDR_PROPPAGE2           REGISTRY                "res\\PropPage2.rgs"

/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//

IDB_DSTBLRG             BITMAP                  "res\\dstblrg.bmp"
IDB_INC32               BITMAP                  "res\\inc32.bmp"
IDB_DSTBMED             BITMAP                  "res\\dstbmed.bmp"
IDB_CFG32               BITMAP                  "res\\cfg32.bmp"
IDB_PROPPAGE            BITMAP                  "res\\PropPage.bmp"

/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//

IDD_CONFIG DIALOGEX 0, 0, 201, 223
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "IncVersion Add-In"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
    DEFPUSHBUTTON   "OK",IDOK,42,201,50,14
    PUSHBUTTON      "Cancel",IDCANCEL,102,201,50,14
    CONTROL         "Enabled",IDC_CHECK_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,7,41,17
    CONTROL         "Active/Startup Project Only",IDC_CHECK_ACTIVE_WORKSPACE,
                    "Button",BS_AUTOCHECKBOX | BS_MULTILINE | NOT WS_VISIBLE | WS_TABSTOP,102,7,83,17
    CONTROL         "Don't Increment If Builds Errors",IDC_CHECK_DONT_WITH_ERRORS,
                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,24,113,10
    GROUPBOX        "Increment which version?",IDC_STATIC,7,37,187,40
    CONTROL         "FileVersion",IDC_CHECK_FILE_VERSION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,48,50,10
    CONTROL         "ProductVersion",IDC_CHECK_PRODUCT_VERSION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,60,64,10
    CONTROL         "PrivateBuild",IDC_CHECK_PRIVATE_BUILD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,48,53,10
    CONTROL         "SpecialBuild",IDC_CHECK_SPECIAL_BUILD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,60,53,10
    GROUPBOX        "Increment which digit?",IDC_STATIC,7,81,187,96
    CONTROL         "Major Version",IDC_RADIO_MAJ,"Button",BS_AUTORADIOBUTTON,18,92,57,8
    CONTROL         "Minor Version",IDC_RADIO_MIN,"Button",BS_AUTORADIOBUTTON,18,104,57,8
    CONTROL         "Revision",IDC_RADIO_REV,"Button",BS_AUTORADIOBUTTON,18,116,57,8
    CONTROL         "Build Number",IDC_RADIO_BLD,"Button",BS_AUTORADIOBUTTON,18,128,57,8
    LTEXT           "(a++, b, c, d)",IDC_STATIC_MAJ,84,92,46,8,SS_NOTIFY
    LTEXT           "(a, b++, c, d)",IDC_STATIC_MIN,84,104,46,8,SS_NOTIFY
    LTEXT           "(a, b, c++, d)",IDC_STATIC_REV,84,116,46,8,SS_NOTIFY
    LTEXT           "(a, b, c, d++)",IDC_STATIC_BLD,84,128,46,8,SS_NOTIFY
    CONTROL         "Reset Minor Version, Revision and Build Number?",IDC_CHECK_RESET,
                    "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,18,140,167,16
    CONTROL         "Revert to incrementing Build Number after one increment of Major Version?",IDC_CHECK_REVERT_TO_BLD,
                    "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,18,156,167,16
    CONTROL         "Display Warnings",IDC_CHECK_DISPLAY_WARNINGS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,183,71,10
END

IDD_PROPPAGE DIALOGEX 0, 0, 201, 199
STYLE DS_SETFONT | WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Sans Serif", 400, 0, 0x0
BEGIN
    CONTROL         "Enabled",IDC_CHECK_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,7,41,17
    CONTROL         "Active/Startup Project Only",IDC_CHECK_ACTIVE_WORKSPACE,
                    "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,103,7,83,17
    CONTROL         "Don't Increment If Builds Errors",IDC_CHECK_DONT_WITH_ERRORS,
                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,24,113,10
    GROUPBOX        "Increment which version?",IDC_STATIC,7,37,187,40
    CONTROL         "FileVersion",IDC_CHECK_FILE_VERSION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,48,50,10
    CONTROL         "ProductVersion",IDC_CHECK_PRODUCT_VERSION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,60,64,10
    CONTROL         "PrivateBuild",IDC_CHECK_PRIVATE_BUILD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,103,48,53,10
    CONTROL         "SpecialBuild",IDC_CHECK_SPECIAL_BUILD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,103,60,53,10
    GROUPBOX        "Increment which digit?",IDC_STATIC,7,81,187,96
    CONTROL         "Major Version",IDC_RADIO_MAJ,"Button",BS_AUTORADIOBUTTON,18,92,57,8
    CONTROL         "Minor Version",IDC_RADIO_MIN,"Button",BS_AUTORADIOBUTTON,18,104,57,8
    CONTROL         "Revision",IDC_RADIO_REV,"Button",BS_AUTORADIOBUTTON,18,116,57,8
    CONTROL         "Build Number",IDC_RADIO_BLD,"Button",BS_AUTORADIOBUTTON,18,128,57,8
    LTEXT           "(a++, b, c, d)",IDC_STATIC_MAJ,84,92,41,8,SS_NOTIFY
    LTEXT           "(a, b++, c, d)",IDC_STATIC_MIN,84,104,41,8,SS_NOTIFY
    LTEXT           "(a, b, c++, d)",IDC_STATIC_REV,84,116,41,8,SS_NOTIFY
    LTEXT           "(a, b, c, d++)",IDC_STATIC_BLD,84,128,41,8,SS_NOTIFY
    CONTROL         "Reset Minor Version, Revision and Build Number?",IDC_CHECK_RESET,
                    "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,18,140,167,16
    CONTROL         "Revert to incrementing Build Number after one increment of Major Version?",IDC_CHECK_REVERT_TO_BLD,
                    "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,18,156,167,16
    CONTROL         "Display Warnings",IDC_CHECK_DISPLAY_WARNINGS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,182,71,10
END

IDD_PROPPAGE2 DIALOGEX 0, 0, 283, 99
STYLE DS_SETFONT | WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Sans Serif", 400, 0, 0x0
BEGIN
    GROUPBOX        "Configurations",IDC_STATIC,7,7,269,85
    CONTROL         "",IDC_LIST_CONFIGS,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,18,20,248,64
END


/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//

#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO 
BEGIN
    IDD_CONFIG, DIALOG
    BEGIN
        LEFTMARGIN, 7
        RIGHTMARGIN, 194
        VERTGUIDE, 18
        VERTGUIDE, 84
        VERTGUIDE, 102
        VERTGUIDE, 185
        TOPMARGIN, 7
        BOTTOMMARGIN, 216
    END

    IDD_PROPPAGE, DIALOG
    BEGIN
        LEFTMARGIN, 7
        RIGHTMARGIN, 194
        VERTGUIDE, 18
        VERTGUIDE, 185
        TOPMARGIN, 7
        BOTTOMMARGIN, 192
    END

    IDD_PROPPAGE2, DIALOG
    BEGIN
        LEFTMARGIN, 7
        RIGHTMARGIN, 276
        VERTGUIDE, 18
        VERTGUIDE, 185
        TOPMARGIN, 7
        BOTTOMMARGIN, 92
    END
END
#endif    // APSTUDIO_INVOKED


/////////////////////////////////////////////////////////////////////////////
//
// Icon
//

// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_MAIN                ICON                    "res\\IncVersion.ico"

/////////////////////////////////////////////////////////////////////////////
//
// String Table
//

STRINGTABLE 
BEGIN
    IDS_PROJNAME            "IncVersion"
END

#endif    // English (U.K.) resources
/////////////////////////////////////////////////////////////////////////////



#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
1 TYPELIB "IncVersion.tlb"

/////////////////////////////////////////////////////////////////////////////
#endif    // not APSTUDIO_INVOKED

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

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


Written By
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.
Jordan.

Comments and Discussions