tags:

views:

1356

answers:

3

Hi All,

I wrote an application and its WiX installer and put it under version control using subversion. When the WiX installer builds I want its version number to be the current build version of the application. How do I accomplish this? I used c# to code the application.

N.B. I am using ccnet to build this project

+1  A: 

This looks reasonably close to what you are trying to accomplish. See what the equivalent is in cruise control.

http://www.ageektrapped.com/blog/setting-properties-for-wix-in-msbuild/

JohnW
+8  A: 

You could use Product/@Version="!(bind.FileVersion.FileId)" and light.exe will populate the value with the version of the file referenced by the FileId.

Rob Mensching
Just what I was looking for! Although I had to use "!(bind.FileVersion.FileId)" (a "!" instead of "$"), otherwise I got a preprocessor directive error.
Nicholas Piasecki
Yeah, sorry, constant mental mistake I make. $ is preprocessor variable and ! is binder variable.
Rob Mensching
+2  A: 

I did this in one of my projects by writing a preprocessor extension to read the file version from my executable. So the WiX file looks something like:

<?define ProductName="$(fileVersion.ProductName($(var.MyApp.TargetPath)))" ?>
<?define CompanyName="$(fileVersion.CompanyName($(var.MyApp.TargetPath)))" ?>
<?define ProductVersion="$(fileVersion.ProductVersion($(var.MyApp.TargetPath)))" ?>
<Product 
    Id="<product ID>" 
    Name="$(var.ProductName)" 
    Version="$(var.ProductVersion)" 
    Manufacturer="$(var.CompanyName)" 
    Language="1033" 
    UpgradeCode="<upgrade code>">

I've posted the code for in on CodePlex: http://wixfileversionext.codeplex.com/

Chris Kaczor