Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Binding WIX FileVersion sub values?

Tags:

wix

In WIX, I can do this to automatically generate a decent version number for my MSI:

<?define ProductVersion="!(bind.FileVersion.MyMainExecutable)" ?>
<Product Version="$(var.ProductVersion)" ... />

That produces a string like "1.0.1.0" but I want only the first three parts: "1.0.1"

How can I accomplish this?

like image 687
l33t Avatar asked Aug 17 '12 13:08

l33t


1 Answers

There isn't a way to only get the first three fields of a bound FileVersion. However, if you are okay assigning the four part version to the Product/@Version (which is completely valid, although major upgrades will only look at the first three fields) then you can access each part of the major, minor, build, and revision using the following variables:

!(bind.property.ProductVersion.Major)
!(bind.property.ProductVersion.Minor)
!(bind.property.ProductVersion.Build)
!(bind.property.ProductVersion.Revision)

Hopefully that can be useful.

like image 63
Rob Mensching Avatar answered Sep 30 '22 14:09

Rob Mensching



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!