0

Using Wix, I am publishing a warning dialog box if the OS of the local machine matches one of several valid operating systems. I can perform this check by putting, for example, VersionNT = 601 in the conditional part of the publish tag.

Because I need to check for multiple operating systems and types (server, domain controller, etc.) I'd like to store some of these conditions in properties and use those custom properties in multiple publish conditions.

Something like:

<Property Id="WinServer08R2" Value="VersionNT = 601 AND MsiNTProductType = 3" />

Then use this property somewhat like this:

<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="WarningDlg">
    WinServer08R2 AND Not Installed
</Publish>
...

Neither this method nor slight variations on it have worked for me thus far. Has anyone else tried this and gotten it to work? One might suggest that I simply use parentheses and make it work, but this is a simplified example and the conditions would quickly get out of hand.

Thanks in advance.

4

1 回答 1

3

Property/@Value(以及与此相关的内部文本)不是条件,它们是属性的实际值。所以你现在拥有的是一个以WinServer08R2字面值命名的属性VersionNT = 601 AND MsiNTProductType = 3。所以WinServer08R2总是评估为真,因为它有一个值。

您应该能够通过使用 Orca 打开生成的 MSI 并查看Property表格来验证这一点。

您想要的是根据条件设置您的属性。

<SetProperty Id="WinServer08R2" Value="1">
    VersionNT = 601 AND MsiNTProductType = 3
</SetProperty>

然后你只需要使用WinServer08R2 = 1or来测试这个属性WinServer08R2

不要忘记使用BeforeAfterSequence属性对自定义操作进行排序。

于 2013-09-16T00:01:18.173 回答