I am building 32 and 64 bit versions of my installer using a single wix project (specifying the -arch candle parameter)
I want to avoid customer confusion and only allow 32 bit installs on a 32 OS and vice versa on 64 bit. Trust me, for my purposes this makes sense.
The following branching condition fails correctly when running the 32 bit installer on the 64 bit OS.
<?if $(sys.BUILDARCH) = x64 ?>
<Condition Message="You are attempting to run the 64-bit installer on a 32-bit version of Windows.">
<![CDATA[VersionNT64]]>
</Condition>
<?else?>
<Condition Message="You are attempting to run the 32-bit installer on a 64-bit version of Windows.">
<![CDATA[NOT VersionNT64]]>
</Condition>
<?endif ?>
However I get an Windows Installer error when running the 64 bit installer on a 32 bit OS. The error is this:
An error occured installing the package. Windows Installer returned '1633'
Searching for this error gets what you would expect:
This installation package is not supported on this platform. Contact your application vendor.
So it appears I am hitting the standard (very poor) windows installer error for "you are using the wrong installer".
Is there any way to get my condition to correctly fire or is this just an impossibility?
MSI won't even open a 64-bit package on a 32-bit OS, so LaunchConditions are never even evaluated. In short, no, nothing you can do.