Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wix工具集MSI:属性值无效时安装程序失败_Wix_Windows Installer - Fatal编程技术网

Wix工具集MSI:属性值无效时安装程序失败

Wix工具集MSI:属性值无效时安装程序失败,wix,windows-installer,Wix,Windows Installer,我有一个微星创建使用Wix 它在product.wxs文件中具有如下定义的属性 <Property Id="MY_FLAG">false</Property> false 我将通过以下方式从命令行调用我的MSI msiexec/i xyz.msi MY_FLAG=true msiexec/i xyz.msi 我希望我的MSI在无效输入的情况下失败,例如 msiexec/i xyz.msi MY_FLAG=sDGsgfdsf 我希望只有当有人将m

我有一个微星创建使用Wix

它在
product.wxs
文件中具有如下定义的属性

<Property Id="MY_FLAG">false</Property>
false
我将通过以下方式从命令行调用我的MSI

  • msiexec/i xyz.msi MY_FLAG=true
  • msiexec/i xyz.msi
我希望我的MSI在无效输入的情况下失败,例如

msiexec/i xyz.msi MY_FLAG=sDGsgfdsf

我希望只有当有人将
my_FLAG
传递为true/false或根本不使用
my_FLAG
时,我的安装才能继续

如果除了true/false之外的任何其他值被传递到
my_FLAG
,我希望我的MSI失败。MSI应失败,而不仅仅是中止。它应该失败

提前感谢您的帮助。

查看操作。在“启动条件”操作中的“安装”中,会在早期对其进行检查。这是在MSI中进行尝试的最佳实践方式。

查看操作。在“启动条件”操作中的“安装”中,会在早期对其进行检查。这是在MSI中执行尝试操作的最佳实践方法。

必须为true,否则安装将中止。下面是一个你可以尝试的片段

启动
cmd.exe
并将
1
2
或一些其他值传递到
msiexec.exe
,然后以快速顺序:
检查
观察
观察值

示例命令行:
msiexec/i WiXLaunchConditionTest.msi MYFLAG=0


错误值
以下是上述内容的完整示例:

必须为true,否则设置将中止。下面是一个你可以尝试的片段

启动
cmd.exe
并将
1
2
或一些其他值传递到
msiexec.exe
,然后以快速顺序:
检查
观察
观察值

示例命令行:
msiexec/i WiXLaunchConditionTest.msi MYFLAG=0


错误值
以下是上述内容的完整示例:

<!-- LAUNCH CONDITION -->

<Property Id="MYFLAG" Hidden="yes" Secure="yes">Wrong Value</Property>
<Condition Message="Value for MYFLAG must be 1 (true) or 0 (false)">
  <![CDATA[MYFLAG=0 OR MYFLAG=1]]>
</Condition>