title: VC++ 2012: How to include version info from version.inc (maintained separately) into the .rc file
body: <p><strong>Summary:</strong> Having the version details defined in the separately maintained <code>version.inc</code> via preprocessor macros... How to include the macro values into the resource version definition block?</p>
  
  <p>My <code>version.inc</code> file is stored in UTF-8 (i.e. pure ASCII in the case). Its full content is the following (the <code>APS_</code> prefix here is related to the real name of the application, not to the <code>.aps</code> file generated by the resource compiler):</p>
  
  <pre><code>#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
  </code></pre>
  
  <p>The Visual Studio 2012 C++ seems to be more picky about the resource script file (<code>app.rc</code>) 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?</p>
  
  <p>Say the version block in the <code>app.rc</code> looks like this:</p>
  
  <pre><code>/////////////////////////////////////////////////////////////////////////////
  //
  // 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: &lt;Company name&gt;"
              VALUE "FileDescription", "TODO: &lt;File description&gt;"
              VALUE "FileVersion", "1.0.0.1"
              VALUE "InternalName", "app.exe"
              VALUE "LegalCopyright", "Copyright (C) 2012"
              VALUE "OriginalFilename", "app.exe"
              VALUE "ProductName", "TODO: &lt;Product name&gt;"
              VALUE "ProductVersion", "1.0.0.1"
          END
      END
      BLOCK "VarFileInfo"
      BEGIN
          VALUE "Translation", 0x405, 1200
      END
  END
  </code></pre>
  
  <p>In the earlier versions of Visual Studio (2005 and 2010), I was able to have the related <code>version.rc2</code> like this:</p>
  
  <pre><code>/////////////////////////////////////////////////////////////////////////////
  //
  // 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
  </code></pre>
  
  <p>Then the <code>version.rc2</code> was included into the <code>app.rc</code> via editing the <code>app.rc</code> 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?</p>
  
  <p>Thanks for you time and experience,</p>
  
  <p>Petr</p>