Sebastian
Sebastian

Reputation: 279

Modifying product version in Wix

I'm trying to bind the file version from my exe file to be used as product version. Following: How can I set the WiX installer version to the current build version?

The problem is that my assembly builds in the format of e.g 2018.0.0.0. The major upgrade requires a version number of max 255, which means that I have to remove the first two numbers from my productVersion variable before setting it to the ProductVersion property. Is there a way to modify the variable through xsl or something else?.

Modifying through a custom action is no alternative since I want the property to be set in the msi file.

Any help in this djungle is appreciated,

 <?define productVersion= !(bind.FileVersion.MyExe.Exe) ?>

 <Product Id="*" 
       UpgradeCode="12345678-1234-1234-1234-123456789123" 
       Name="My Application" 
       Language ="1033" 
       Version="$(var.productVersion)"
       Manufacturer="My Company" >

Upvotes: 3

Views: 2803

Answers (1)

Christopher Painter
Christopher Painter

Reputation: 55620

If you can't bind/infer from your assembly then you will need to have your build automation pass a wix variable into candle.exe and use that instead of your bind statement.

In a managed code / vsts / tfs environment my typical flow is that the build definition is the source of truth and it increments and sets a buildnumber during the build. A powershell script updates all the AssemblyFileVersion attributes across my AssemblyInfo files based on this and my wixproj (votive/msbuild) does a regex match on this variable to pass it through to candle.

Upvotes: 4

Related Questions