How do I conditionally install a file with WiX based on the target machine (32bit or 64bit)?

StackOverflow https://stackoverflow.com/questions/730534

  •  06-09-2019
  •  | 
  •  

Question

I have a file that has a 32bit version and a 64bit version. If I install my application on a 32bit machine, I want the 32bit version of the file to be installed. Likewise, the 64bit version should get installed if the installation is run on a 64bit machine. How do I check which type of machine the installer is being run on with WiX?

Please, no one-line answers. I'm looking for specific WiX tags and where to put them in my WiX script.

Was it helpful?

Solution

You could probably just do two separate components, using the conditions

 VersionNT64

and

 Not VersionNT64

But the correct way is to compile separate installers for 32 and 64 bit OS's and 64-bit components should also be marked as such (with Win64="yes") - I don't know if it's even possible to mark a Windows Installer package as targeted towards both Intel and x64. Only time I've ever done a mixed architecture installation is with NSIS, all my WiX installers have separate installers for each architecture.

OTHER TIPS

The proper way of doing so is to compile two setups, one for 32 (x86) and one for 64 (amd64). Then you package those two msi inside a single msi and run the appropriate one at runtime.

You could create a base wxs file using environment or preprocessor variables and fill in the required attributes before compiling. Another option would be running a script before the build that includes different GUIDs in the file for specific installation. In short, I don't think there is a simple way of building installers for different architectures, so you have to use additional utilities.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top