TFSVersion & C++ Res files

May 18, 2010 at 9:26 AM

Does TFSVersion MSBuildExtension support updating .res files in a similar way to how it handles assembly files?

Coordinator
May 18, 2010 at 9:35 AM

No. You would need to look at using the Replace TaskAction in the File task.

I'm not familiar with .res files. I'll take a look and see what can be done.

Basically you want to version your c++ assemblies right?

Mike

May 18, 2010 at 9:36 AM

Thanks Mike, thats what I'm looking for.

Ben

Coordinator
May 18, 2010 at 10:00 AM

What do you have in your .res file.

I have a basic cpp project with

[assembly: AssemblyFileVersion("1.0.*")]

and SetVersion works ok on it.

 

Mike

 

May 18, 2010 at 10:04 AM
I'm not talking about a managed application. The resource file I have is shown below, and I am looking to replace the "2.0.0.0" and "2,0,0,0" values with new version numbering, // Microsoft Visual C++ generated resource script. // #include "resource.h" #define APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 2 resource. // #include "afxres.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 ""afxres.h""\r\n" "\0" END 3 TEXTINCLUDE BEGIN "\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 ///////////////////////////////////////////////////////////////////////////// // // Version // VS_VERSION_INFO VERSIONINFO FILEVERSION 2,0,0,0 PRODUCTVERSION 2,0,0,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x29L #else FILEFLAGS 0x28L #endif FILEOS 0x4L FILETYPE 0x2L FILESUBTYPE 0x0L BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "080904b0" BEGIN VALUE "Comments", "xxxxxxx" VALUE "CompanyName", "yyyyyy" VALUE "FileDescription", "file.dll" VALUE "FileVersion", "2.0.0.0" VALUE "InternalName", "file.dll" VALUE "LegalCopyright", "Copyright (C) . 2009" VALUE "LegalTrademarks", "Copyright (C) . 2009" VALUE "OriginalFilename", "file.dll" VALUE "PrivateBuild", "2.0.0.0" VALUE "ProductName", "file.dll" VALUE "ProductVersion", "2.0.0.0" VALUE "SpecialBuild", "2.0.0.0" END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x809, 1200 END END #endif // English (U.K.) resources ///////////////////////////////////////////////////////////////////////////// #ifndef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 3 resource. // ///////////////////////////////////////////////////////////////////////////// #endif // not APSTUDIO_INVOKED
May 18, 2010 at 10:07 AM

// Microsoft Visual C++ generated resource script.
//
#include "resource.h"

#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.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 ""afxres.h""\r\n"
    "\0"
END

3 TEXTINCLUDE
BEGIN
    "\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

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

VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,0,0,0
PRODUCTVERSION 2,0,0,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x29L
#else
FILEFLAGS 0x28L
#endif
FILEOS 0x4L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "080904b0"
        BEGIN
            VALUE "Comments", "yyy"
            VALUE "CompanyName", "Ltd."
            VALUE "FileDescription", "file.dll"
            VALUE "FileVersion", "2.0.0.0"
            VALUE "InternalName", "file.dll"
            VALUE "LegalCopyright", "Copyright (C) Ltd. 2009"
            VALUE "LegalTrademarks", "Copyright (C) Ltd. 2009"
            VALUE "OriginalFilename", "file.dll"
            VALUE "PrivateBuild", "2.0.0.0"
            VALUE "ProductName", "file.dll"
            VALUE "ProductVersion", "2.0.0.0"
            VALUE "SpecialBuild", "2.0.0.0"
        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x809, 1200
    END
END

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



#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//


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

Coordinator
May 18, 2010 at 10:08 AM

Right, once you have the version using GetVersion, you can use the TextString class to create another property with commas instead of dots, then you need to use the Replace task..... not a nice easy step, but it should work.

Mike

May 18, 2010 at 10:09 AM

Thanks Mike, ill give that a try.