Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8675045
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T19:51:11+00:00 2026-06-12T19:51:11+00:00

Summary: Having the version details defined in the separately maintained version.inc via preprocessor macros…

  • 0

Summary: Having the version details defined in the separately maintained version.inc via preprocessor macros… How to include the macro values into the resource version definition block?

My version.inc file is stored in UTF-8 (i.e. pure ASCII in the case). Its full content is the following (the APS_ prefix here is related to the real name of the application, not to the .aps file generated by the resource compiler):

#define APS_MAJORNUMBER          4
#define APS_MINORNUMBER          5
#define APS_BUILDNUMBER          0
#define APS_MODIFICATIONNUMBER   0
#define APS_BUILDEXT              "wx"
#define APS_DATEYEAR          2012
#define APS_DATEMONTH           10
#define APS_DATEDAY              4

The Visual Studio 2012 C++ seems to be more picky about the resource script file (app.rc) than the Visual Studio 2010 was. The first thing I have noticed is that when editing it manually, I have to keep the UTF-16 encoding. Can you confirm that? Is there any documentation on that?

Say the version block in the app.rc looks like this:

/////////////////////////////////////////////////////////////////////////////
//
// Version
//

VS_VERSION_INFO VERSIONINFO
 FILEVERSION 1,0,0,1
 PRODUCTVERSION 1,0,0,1
 FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
 FILEFLAGS 0x1L
#else
 FILEFLAGS 0x0L
#endif
 FILEOS 0x40004L
 FILETYPE 0x1L
 FILESUBTYPE 0x0L
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "040504b0"
        BEGIN
            VALUE "CompanyName", "TODO: <Company name>"
            VALUE "FileDescription", "TODO: <File description>"
            VALUE "FileVersion", "1.0.0.1"
            VALUE "InternalName", "app.exe"
            VALUE "LegalCopyright", "Copyright (C) 2012"
            VALUE "OriginalFilename", "app.exe"
            VALUE "ProductName", "TODO: <Product name>"
            VALUE "ProductVersion", "1.0.0.1"
        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x405, 1200
    END
END

In the earlier versions of Visual Studio (2005 and 2010), I was able to have the related version.rc2 like this:

/////////////////////////////////////////////////////////////////////////////
//
// Version
//

#include "version.inc"

#define STR(value) #value
#define STRINGIZE(value) STR(value)
#define APS_FULLVERSION_STR \
  STRINGIZE(APS_MAJORNUMBER) "." \
  STRINGIZE(APS_MINORNUMBER) "." \
  STRINGIZE(APS_BUILDNUMBER) "." \
  STRINGIZE(APS_MODIFICATIONNUMBER)


VS_VERSION_INFO VERSIONINFO
 FILEVERSION APS_MAJORNUMBER,APS_MINORNUMBER,APS_BUILDNUMBER,APS_MODIFICATIONNUMBER
 PRODUCTVERSION APS_MAJORNUMBER,APS_MINORNUMBER,APS_BUILDNUMBER,APS_MODIFICATIONNUMBER
 FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
 FILEFLAGS 0x29L
#else
 FILEFLAGS 0x28L
#endif
 FILEOS 0x4L
 FILETYPE 0x1L
 FILESUBTYPE 0x0L
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "000004b0"
        BEGIN
            VALUE "Comments", "A fairly useful tool named APS"
            VALUE "CompanyName", "The company name"
            VALUE "FileDescription", "app"
            VALUE "FileVersion", APS_FULLVERSION_STR
            VALUE "InternalName", "aps"
            VALUE "LegalCopyright", "Copyright © 1993-" STRINGIZE(APS_DATEYEAR)
            VALUE "OriginalFilename", "app.exe"
            VALUE "PrivateBuild", ""
            VALUE "ProductName", "APS of the version 4"
            VALUE "ProductVersion", APS_FULLVERSION_STR
            VALUE "SpecialBuild", APS_BUILDEXT
        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x0, 1200
    END
END

Then the version.rc2 was included into the app.rc via editing the app.rc manually. However, I cannot repeat the process with the Visual Studio 2012 project and resource file. I may be doing some mistake invisible to me. Should that approach work also in Visual Studio 2012?

Thanks for you time and experience,

Petr

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T19:51:12+00:00Added an answer on June 12, 2026 at 7:51 pm

    Here is the way to do it via Visual Studio 2012 (C++, IDE). Firstly, it seems that all the files (app.rc, version.rc2 with the version section to be included into app.rc, and also the version.inc with the values maintained separately [included into version.rc2]) must be stored in UTF-16 — unlike in the earlier versions of Visual Studio. Then I was able to repeat the same approach also in Visual Studio 2012.

    However, you do not need to edit the app.rc file manually. You can use the following steps using the IDE:

    • Open the project (App) and switch to the Resource View tab.
    • Unfold the App project, unfold its app.rc, and unfold the Version folder. You can see the VS_VERSION_INFO item.
    • Mark the VS_VERSION_INFO item and pres Delete key on the keyboard. The item and its upper Version folder disappear.
    • Mouse right-click the app.rc folder, and select the Resource Includes…. The dialog with the same name and with three input panes appear.

    Resourde Includes dialog

    • Focus on the bottom pane named Compile-time directives:, and write the #include "version.rc2" there. (The file must not have the .rc extension, but the .rc2 is fine and recommended elsewhere in the MSDN doc.)
    • Press OK, and save all files (to save also the modified app.rc).

    The result of the steps is that you will not see the Version folder and the VS_VERSION_INFO item in the resource tree (see Resource View tab); however, the above mentioned constructed Version section (stored inside the version.rc2) is compiled into the application resources.

    Technically, the following parts of the app.rc file can be found after the steps:

    3 TEXTINCLUDE 
    BEGIN
        "#include ""version.rc2""\r\n"
        "\0"
    END
    

    …

    #ifndef APSTUDIO_INVOKED
    /////////////////////////////////////////////////////////////////////////////
    //
    // Generated from the TEXTINCLUDE 3 resource.
    //
    #include "version.rc2"
    
    /////////////////////////////////////////////////////////////////////////////
    #endif    // not APSTUDIO_INVOKED
    

    Any constructive comments to enhance the topic are welcome and will be +1-ed 🙂

    Have a nice time,

    Petr

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having the following string as input : BEGIN:VCALENDAR VERSION:2.0 BEGIN:VEVENT SUMMARY;CHARSET=utf-8:hello LOCATION;CHARSET=utf-8:loc
In summary, I am having a problem where I read what I expect to
Summary: I am having trouble connecting to an exchange 2007 mailbox that is running
Summary: We're having problems with EF4 query compilation times of 12+ seconds. Cached queries
I've to correct the google search title and summary for a website having the
I'm having issues here implementing the SimpleModal ( http://www.ericmmartin.com/projects/simplemodal/ ) version of a modal
I'm having problems to find the latest API version of PayPal. The current version
I'm having one of those days.... Here's my class: /// <summary> /// Represent a
I'm having trouble finding a good summary of the advantages/disadvantages of using pgbouncer for
Summary New to iPhone programming, I'm having trouble picking the right optimization strategy to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.