Skip to content
Richard Fennell edited this page May 2, 2017 · 2 revisions

WIX Versioner

WIX is a very flexible tool, hence my Wix versioning task has to make some assumptions over the way it will be used.

Assumption 1 - There is a file call INSTALLERVERSION.WXI

This file contains the definition of the various version number parts. Note that it shows the separate parts and the fully built four part 1.0.0.0 number.

<?xml version="1.0" encoding="utf-8"?>
<!-- Note that this file will be overridden by the build server. -->
<Include>
  <?define MajorVersion = "1" ?>
  <?define MinorVersion = "0" ?>
  <?define BuildNumber  = "0" ?>
  <?define Revision     = "0" ?>
  <?define FullVersion  = "1.0.0.0" ?>
  <!--WiX Installer Versions are Major.Minor.Revision -->
</Include>

This the file the task will be updating.

Assumption 2 - We include the INSTALLERVERSION.WXI in our WIX project

In our Wix product.wxs we need to include the InstallerVersion.wxi file and then can use the defined variables in the Version property in any way we wish, using the individual parts or the whole multi-part version number

<?xml version="1.0" encoding="UTF-8"?>
<?include InstallerVersion.wxi ?> 
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Product Id="*" Name="WixProject" Language="1033" Version="$(var.FullVersion)"  Manufacturer="Test"
           UpgradeCode="510ca227-7d91-43f4-881c-13319a07b299">

... rest of file

Usage

In most cases all that is required to use this extension is to drop the Wix Versioning Task into your build process. All the defaults are correct for the assumptions above. The task will recursively look for installerversion.wxi and update them using the four part build number extracted from build number, as per all the other versioning tasks.

Clone this wiki locally