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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With