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

若如初见. 提交于 2019-12-23 09:36:38

问题


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.


回答1:


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.




回答2:


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.




回答3:


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.



来源:https://stackoverflow.com/questions/730534/how-do-i-conditionally-install-a-file-with-wix-based-on-the-target-machine-32bi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!