Visual Studio 2008 Preprocessor wierdness
- by Canacourse
We have set-up a simple versioning system for our builds to ensure the built files always indicate whether they are Beta Debug or Beta Release builds
I moved the file version info to to myapp.rc2 and created version.h
// version.h
// _DEBUG is defined by VS
#define _BETA
#ifdef _BETA
#define FILE_DESC1 _T("BETA ")
#else
#define FILE_DESC1 // blank on purpose
#endif
#ifdef _DEBUG
#define FILE_DESC2 _T("Debug Version ")
#else
#define FILE_DESC2 _T("Release Version ") // this is greyed out in the ide when building
#endif
#define FILE_DESC FILE_DESC1 FILE_DESC2
// myapp.rc2
include "version.h"
#ifndef _T
#define _T(x) x
#endif
VS_VERSION_INFO VERSIONINFO
FILEVERSION PROD_VER_MJR,PROD_VER_MIN,PROD_VER_UPD,JOBUILDER_BUILD
PRODUCTVERSION PROD_VER_MJR,PROD_VER_MIN
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904e4"
BEGIN
VALUE "CompanyName", COMPANY_NAME
VALUE "FileDescription", FILE_DESC
VALUE "FileVersion", JOBBUI_VERSION
VALUE "InternalName", "MyApp.exe"
VALUE "LegalCopyright", COPYRIGHT
VALUE "OriginalFilename", "MyApp.exe"
VALUE "ProductName", PRODUCT_NAME
VALUE "ProductVersion", PRODUCT_VERSION
VALUE "Comments", COMMENTS
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1252
END
END
However when the exe is built in the debug output directory the file description always incorrectly says "BETA Release Version" instead of "BETA Debug Version" Yet the IDE indicates that "#define FILE_DESC2 _T("Debug Version ")" would be used. Why might this be? I have used these files on another project and they work correctly.
Thank You...