Search code examples
tfswixmajor-upgrade

WiX MajorUpdate element not working as expected


I am using WiX 3.10

The following Wxs file defines my WiX installer. However, I recently wanted to remove older versions before installing the new one. To my surprise, it works locally, but when it built by tfs it behaves differently, see the following example

Assume I have version 2.0.1 installed

  1. I queue a new build for the project and get tfs to create my 2.0.2 msi
  2. I run 2.0.2 msi
  3. I check program and features interface and I see both 2.0.1 and 2.0.2
  4. I kick off another tfs build and get 2.0.3 msi
  5. I run 2.0.3 msi
  6. I check program and features window and I see 2.0.2 and 2.0.3 (2.0.1 has been removed!)

can someone explains why I am getting such a strange behavior ? I have a pre-build script that updates the product Idelement to a new guid and the version element to match the tfs build number (so I am guaranteed a new guid and a new version number on each build)

Here is my Wxs

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Product Id="*"
           Name="xxx"
           Language="1033"
           Version="0.0.0.0"
           Manufacturer="xxx"
           UpgradeCode="FC30BA3E-619C-4247-988E-2823831E9E04">
    <Package Compressed="yes"
             InstallerVersion="200"
             Manufacturer="xxx"
             Description="xxx"
             Comments="(C) 2016 xxx"
             Platform="x64"
             InstallScope="perMachine"/>
             ...
    <MajorUpgrade
             Schedule="afterInstallInitialize"
             DowngradeErrorMessage="A newer version of [ProductName] is already installed."/>
  </Product>
</Wix>

Solution

  • Well, it turns out that the version should be of 3 parts and not 4 e.g: 1.0.0.1 won't work hoever 1.0.1 worked for my case