0

I am not sure if it lack of understanding or not but I have the following code implemented in my WiX installer

<?ifdef svn.BUILD_NUMBER?>
  <?define PRODUCTVERSION="1.0.$(svn.BUILD_NUMBER).0"?>
<?else?>
  <?define PRODUCTVERSION="1.0.1.0"?>
<?endif?>

<Product Id="*" Name="My Installer" Language="1033" Version="$(var.PRODUCTVERSION)" Manufacturer="My Corporation" UpgradeCode="170e2710-5690-4433-8787-7bcd0a922fbc">

No matter what I try however I cannot get the installer to use the SVN revision number...am I missing something/doing something wrong?

Micha
  • 5,117
  • 8
  • 34
  • 47
Jimmy
  • 941
  • 2
  • 8
  • 27
  • svn is not a built-in variable prefix (ie: var, env and sys). It has to be defined in a preprocessor extension. Are you using one? If not, it could definitely be a way to get that information into your project. – Netfangled Jul 13 '13 at 00:15

1 Answers1

1

Variables must have one of the three prefixes, depending on how they are created:

  • var.
  • env.
  • sys.

Documentation

Where is this "svn.BUILD_NUMBER" coming from?

UPDATE:

From your comment, it seems like you need to get the revision number from outside your project and bring it inside. There are many ways to do this. Some CI servers will set an environment variable for the build that gives the revision number.

In any case, you have to correct your preprocessor variable usage by using var. or env.:

<?ifdef env.BUILD_NUMBER?>
  <?define PRODUCTVERSION="1.0.$(env.BUILD_NUMBER).0"?>
<?else?>
  <?define PRODUCTVERSION="1.0.1.0"?>
<?endif?>

If you need to create the environment variable first, running a command like this would do it:

set BUILD_NUMBER=
for /F "tokens=1,2"  %t  in ('svn info') do ^
    @if "%t"=="Revision:" set BUILD_NUMBER=%u

You can get a lot fancier, depending on your needs: Generate a WiX Include (.wxi), use MSBuild (see the article you referenced) to run tasks such as executing svn info, use snv info --xml with some XML processing,....

Tom Blodget
  • 20,260
  • 3
  • 39
  • 72
  • To be 100% honest I remember trying to do this a while ago and stumbled across this annotation, I cannot seem to find the original source. The idea behind it though is that the svn.BUILD_NUMBER is being derived from the Revision number given to the project folder from SVN... upon looking back at this I realize that this would have never worked. I did however attempt to implement something I found here (http://www.ageektrapped.com/blog/setting-properties-for-wix-in-msbuild/) but I still am having no luck – Jimmy Jul 12 '13 at 19:36