Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WiX: Prevent 32-bit installer from running on 64-bit Windows

Due to user confusion, our app requires separate installers for 32-bit and 64-bit versions of Windows. While the 32-bit installer runs fine on win64, it has the potential to create support headaches and we would like to prevent this from happening.

I want to prevent the 32-bit MSI installer from running on 64-bit Windows machines. To that end I have the following condition:

<Condition Message="You are attempting to run the 32-bit installer on a 64-bit version of Windows.">
  <![CDATA[Msix64 AND (NOT Win64)]]>
</Condition>

With the Win64 defined like this:

<?if $(var.Platform) = "x64"?>
<?define PlatformString = "64-bit"?>
<?define Win64 ?>
<?else?>
<?define PlatformString = "32-bit"?>
<?endif?>

Thing is, I can't get this check to work right. Either it fires all the time, or none of the time. The goal is to check presence of the run-time msix64 variable against the compile-time Win64 variable and throw an error if these don't line up, but the logic is not working how I intend it to. Has anyone come up with a better solution?

like image 558
Tom Corelis Avatar asked Mar 16 '10 22:03

Tom Corelis


People also ask

Can 32bit program run on 64bit?

Can I run 32-bit programs on a 64-bit computer? Most programs made for the 32-bit version of Windows will work on the 64-bit version of Windows except for most Antivirus programs. Device drivers that are made for the 32-bit version of Windows will not work correctly on a computer running a 64-bit version of Windows.

What is WiX Installer used for?

Windows Installer XML Toolset (WiX, pronounced "wicks"), is a free software toolset that builds Windows Installer packages from XML. It consists of a command-line environment that developers may integrate into their build processes to build MSI and MSM packages.

How do I install WiX on Windows?

Steps to Install WiX on Windows 11.1 and click on the download button. Step 2: You will be redirected to the source code present in the version control system GIT, and we need to choose the appropriate .exe file and click on download. Here we have chosen wix311.exe and click on it, and then it will be downloaded.


2 Answers

We use the following...

<?if $(var.ProcessorArchitecture)=x86 ?>
<Condition Message="!(loc.LaunchCondition_Error64)">
    <![CDATA[Installed OR Not VersionNT64]]>
</Condition>
<?endif?>
like image 21
saschabeaumont Avatar answered Sep 25 '22 13:09

saschabeaumont


Include the Condition element only in your 32-bit package (i.e., using ?if? preprocessor statement). The Condition would be "NOT Msix64": Launch conditions are things that must be true, so if Msix64 is set, the launch condition would fail and that means it's an x64 OS and a 32-bit package and the correct thing to do is to block.

like image 53
Bob Arnson Avatar answered Sep 22 '22 13:09

Bob Arnson