WiX:阻止32位安装程序在64位Windows上运行 [英] WiX: Prevent 32-bit installer from running on 64-bit Windows

查看:74
本文介绍了WiX:阻止32位安装程序在64位Windows上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于用户的困惑,我们的应用需要分别安装32位和64位Windows版本的安装程序.虽然32位安装程序可以在win64上正常运行,但有可能造成支持问题,我们希望防止这种情况的发生.

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.

我想阻止32位MSI安装程序在64位Windows计算机上运行.为此,我具有以下条件:

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>

Win64定义如下:

With the Win64 defined like this:

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

问题是,我无法使此检查正常工作.它要么一直触发,要么没有时间触发.目的是对照编译时的 Win64 变量检查运行时的 msix64 变量是否存在,如果没有将它们抛出错误,则抛出错误,但是逻辑是不按我的预期去做.有没有人想出更好的解决方案?

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?

推荐答案

仅在您的32位程序包中包含Condition元素(即,使用?if?预处理程序语句).条件为"NOT Msix64":启动条件必须是正确的,因此,如果设置了Msix64,启动条件将失败,这意味着它是x64 OS和32位程序包,正确的操作是阻止.

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.

这篇关于WiX:阻止32位安装程序在64位Windows上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆