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 bui
You can pass the version to the MSBuild script for your setup project the same as you can pass for application's build script.
For example, if your CI system defines variables AppVersion
and BuildNumber
, and passes them to your MSBuild scripts, your wixproj can create a corresponding Version
property which it forwards to Wix like this:
0.0.1
$(AppVersion).$(BuildNumber)
Version=$(Version)
The first definition of Version
provides a default for when you're building locally. Whatever it ends up with becomes a Version
variable in Wix. Use it in a wsx file like this:
I like to include the version in the description so that it's easy to look up from Window Explorer (as a column in Detail view or on the Properties page) independent of the file name.
Passing the version as a variable gives you more control than reading it from a file. When you read from a file, you get all 4 parts of the programmatic version. However, ProductVersion is only designed to use the first 3 parts.