防止使用 WIX 的 PROCESSOR_ARCHITECTURE 环境变量在 x64 上安装 32 位 WIX 安装程序 [英] Prevent to install 32 bit WIX installer on x64 using PROCESSOR_ARCHITECTURE Enviroment variables of WIX

查看:27
本文介绍了防止使用 WIX 的 PROCESSOR_ARCHITECTURE 环境变量在 x64 上安装 32 位 WIX 安装程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个适用于 32 位和 64 位平台的 Wix Setup msi.
我想阻止它在 64 位操作系统上安装 32 位 msi,在 32 位操作系统上安装 64 位 msi.
虽然 WIX 阻止在 32 位 msi 上安装 64 位 msi,但我也想实现反向.

I have a Wix Setup msi for both 32 bit and 64 bit platform.
I want to prevent it to install 32 bit msi on 64 bit OS and 64 bit msi on 32 bit OS.
Although WIX prevent to install 64 bit msi on 32 bit msi but i want to achieve reverse also.

我正在使用以下代码:-

I was using the below code :-

<?if $(var.Platform)=x86 ?>
<Condition Message="Setup can not be installed on x64 machine.">
  <![CDATA[Installed OR Not VersionNT64]]>
</Condition>
<?endif?>

但它显示在我的 msi 的欢迎页面上.我想显示与我在 32 位操作系统(例如

but it display at the welcome page of my msi. I want to display the message same as i get when i install 64 bit msi on 32 bit os such as

此处理器类型不支持安装包.请联系您的支持人员

The Installation Package is not supported by this processor type.Contact your support personnel

我怎样才能做到这一点?

How can i achieve this?

推荐答案

那个条件应该可行!我在想可能变量 Platform 没有正确设置.

That condition should work! I'm thinking maybe the variable Platform is not being set properly.

你也可以试试这个(和你的差不多):

You could also try this (which is pretty much the same as yours):

    <?if $(var.Platform) = x86 ?>
        <Condition Message="Setup can not be installed on x64 machine.">
            <![CDATA[Not VersionNT64]]>
        </Condition>
    <?endif?>

编辑:我在@Christopher Painter 评论后删除了 Platform=x64 条件,因为您可以在 x64 msis 上免费获得该条件.我也试过上面的代码,它有效.

Edit: I removed the Platform=x64 condition after @Christopher Painter comment because you get that for free on x64 msis. I also tried the code above and it works.

这篇关于防止使用 WIX 的 PROCESSOR_ARCHITECTURE 环境变量在 x64 上安装 32 位 WIX 安装程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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