WiX

64-bit MSI packages require Windows Installer 2.0.

File this tidbit under documented but cryptic and missing an error message. I was recently creating 32-bit and 64-bit MSIs using the WiX toolset. The very helpful -arch command line switch to candle made it easy to build for both architectures with the same codebase. Maybe a little too easy.

The 32-bit MSI worked great. However, trying to do anything with the 64-bit package (including validation) always gave the error message:

This installation package could not be opened. Contact the application vendor to verify that this is a valid Windows Installer package.

That stumped me for a while. For some reason, I kept coming back to the Package element in my .wxs file. Something didn’t seem quite right. It looked like this:

<Package InstallScope="perMachine" Compressed="yes" />

See anything wrong? I’m building a per-machine install with all the files compressed so that’s all good. The -arch command line switch is going to handle setting the Package/@Platform attribute for me correctly so I don’t need that attribute.

I ended up reading the documentation again and again before I came across this little gem in the Package element documentation that I had totally forgotten.

InstallerVersion - The minimum version of the Windows Installer required to install this package. Take the major version of the required Windows Installer and multiply by a 100 then add the minor version of the Windows Installer. For example, “200” would represent Windows Installer 2.0 and “405” would represent Windows Installer 4.5. For 64-bit Windows Installer packages, this property must be set to 200 or greater.

That last bit is my emphasis. Of course! 64-bit packages were not supported until Windows Installer v2.0 so you need to mark the package as such. The fix? Easy.

<Package InstallScope="perMachine" Compressed="yes"
         InstallerVersion="200" />

I was happy to have a fix in hand but disappointed the WiX toolset didn’t catch this for me. I opened a bug to track the issue and will fix it sometime in WiX v3.5.

In the meantime, remember when creating a 64-bit package, be sure to mark your package to require Windows Installer 2.0 or better.