What’s up with my launch condition? It’s supposed to prevent the x86 installer from running on a 64-bit system, but it seems to have no effect.
<!-- Launch Condition to check that x64 installer is used on x64 systems -->
<Condition Message="64-bit operating system was detected, please use the 64-bit installer.">
<![CDATA[VersionNT64 AND ($(var.Win64) = "no")]]>
</Condition>
var.Win64 is derived from the MSBuild variables like this:
<!-- Define platform-specific names and locations -->
<?if $(var.Platform) = x64 ?>
<?define ProductName = "$(var.InstallName) (x64)" ?>
<?define Win64 = "yes" ?>
<?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?>
<?define PlatformCommonFilesFolder = "CommonFiles64Folder" ?>
<?else ?>
<?define ProductName = "$(var.InstallName) (x86)" ?>
<?define Win64 = "no" ?>
<?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?>
<?define PlatformCommonFilesFolder = "CommonFilesFolder" ?>
<?endif ?>
I would like to solve my problem, but I’d also be interested to hear about strategies for troubleshooting this type of problem.
According to the LaunchCondition table definition:
Your condition consists of 2 parts: the first one evaluates at install time, the other one evaluates at build time. So, for x86 package the second part of condition will evaluate to “no” = “no” at build time, which obviously gives True at install time. And the first part – VersionNT64 – is defined (and thus, True) on x64 machines. That’s why the whole condition is True and installation starts.
You can rewrite your condition as follows:
Hence, in 64-bit package the condition will be just
VersionNT64, and will pass and start install. Form x86 package the condition will beNOT VersionNT64, which will obviously fail on 64-bit, but start on 32-bit.