Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio with SubWCRev auto-build versioning problem

Folks,

I'm using VS2010 and trying to sync the build version of my project with my Subversion repository using SubWCRev. This is all working correctly, but I can't quite get my head around one thing. My template file consists of this :

#define MAJOR_VERSION       2
#define MINOR_VERSION       2
#define MICRO_VERSION       0
#define BUILD_VERSION       $WCMODS?$WCREV$+1:$WCREV$$

#define QUOTE_(x) #x
#define QUOTE(x) QUOTE_(x)

#define BUILD_VERSION_STRING    QUOTE(MAJOR_VERSION.MINOR_VERSION.MICRO_VERSION.BUILD_VERSION)

Then in my application .RC file I have :

 FILEVERSION MAJOR_VERSION,MINOR_VERSION,MICRO_VERSION,BUILD_VERSION
 PRODUCTVERSION MAJOR_VERSION,MINOR_VERSION,MICRO_VERSION,BUILD_VERSION
 FILEFLAGSMASK 0x17L
#ifdef _DEBUG
 FILEFLAGS 0x1L
#else
 FILEFLAGS 0x0L
#endif
 FILEOS 0x4L
 FILETYPE 0x1L
 FILESUBTYPE 0x0L
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "080004e4"
        BEGIN
            VALUE "FileVersion", BUILD_VERSION_STRING
            VALUE "ProductVersion", BUILD_VERSION_STRING
        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x800, 1252
    END
END

As you can probably work out, I'm trying to up the build version by 1 if there's modified code so that the build version in the EXE will match the Subversion revision number when I do a release and check the code in. The problem is that BUILD_VERSION gets expanded to x+1 or x+0 which then appears in the BUILD_VERSION_STRING as "2.2.0.227+1" which is not quite what I intended.

Does anyone with a little more experience with this know a way to achieve my aim? Thanks in advance

like image 348
Redeye Avatar asked Dec 18 '25 13:12

Redeye


2 Answers

#define BUILD_VERSION       $WCMODS?$WCREV+1$:$WCREV$$
like image 90
Markus Jarderot Avatar answered Dec 21 '25 16:12

Markus Jarderot


Im my group we only automate the update of the least significant value with the svn revision number for the projects working directory. To do this we have added a pre-build step to each project that creates and then calls a batch script that does the following:

  1. Copy $(ProjectDir)Properties\AssemblyInfo.cs to $(ProjectDir)Properties\AssemblyInfo.cs.template.
  2. Find AssemblyVersion("X.Y.Z.ddd") in $(ProjectDir)Properties\AssemblyInfo.cs.template and replace with AssemblyVersion("X.Y.Z.$WCREV$").
  3. Find AssemblyFileVersion("X.Y.Z.ddd") in $(ProjectDir)Properties\AssemblyInfo.cs.template and replace with AssemblyFileVersion("X.Y.Z.$WCREV$").
  4. Run 'SubWCRev $(ProjectDir) $(ProjectDir)Properties\AssemblyInfo.cs.template $(ProjectDir)Properties\AssemblyInfo.cs'
like image 22
user481779 Avatar answered Dec 21 '25 17:12

user481779



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!