Tim*_*ong 7 wix launch-condition wix3.5
我的发射条件怎么样?它应该阻止x86安装程序在64位系统上运行,但似乎没有任何效果.
<!-- Launch Condition to check that x64 installer is used on x64 systems -->
<Condition Message="64-bit operating system was detected, please use the 64-bit installer.">
<![CDATA[VersionNT64 AND ($(var.Win64) = "no")]]>
</Condition>
Run Code Online (Sandbox Code Playgroud)
var.Win64 是从MSBuild变量派生的,如下所示:
<!-- Define platform-specific names and locations -->
<?if $(var.Platform) = x64 ?>
<?define ProductName = "$(var.InstallName) (x64)" ?>
<?define Win64 = "yes" ?>
<?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?>
<?define PlatformCommonFilesFolder = "CommonFiles64Folder" ?>
<?else ?>
<?define ProductName = "$(var.InstallName) (x86)" ?>
<?define Win64 = "no" ?>
<?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?>
<?define PlatformCommonFilesFolder = "CommonFilesFolder" ?>
<?endif ?>
Run Code Online (Sandbox Code Playgroud)
我想解决我的问题,但我也有兴趣了解解决此类问题的策略.
根据LaunchCondition表定义:
必须求值为True才能开始安装的表达式.
您的条件由两部分组成:第一部分在安装时评估,另一部分在构建时评估.因此,对于x86包,条件的第二部分将在构建时评估为"no"="no",这显然在安装时给出True.第一部分 - VersionNT64 - 在x64机器上定义(因此,True).这就是整个条件为True并开始安装的原因.
您可以按如下方式重写您的条件:
<Condition Message="64-bit operating system was detected, please use the 64-bit installer.">
<?if $(var.Win64) = "yes" ?>
VersionNT64
<?else?>
NOT VersionNT64
<?endif?>
</Condition>
Run Code Online (Sandbox Code Playgroud)
因此,在64位软件包中,条件将是正常的VersionNT64,并将通过并开始安装.表单x86包的条件是NOT VersionNT64,64位显然会失败,但是32位启动.