问题
Hi I am trying to add launch condition to check IIS Version installed is greater than 7 if not it should display compliance message.
<PropertyRef Id="IISMAJORVERSION"/>
<Condition Message="Install requires IIS 7 or higher">
<![CDATA[IISMAJORVERSION AND (IISMAJORVERSION >= #7)]>
</Condition>
Also tried IISMAJORVERSION >= "#7" and IISMAJORVERSION >= "#7" but it is not showing condition message on the machines which doesn't have IIs installed. Please help.
回答1:
Check MSI: Open your compiled MSI in Orca (or an equivalent tool - see towards bottom). Are there entries in the LaunchCondition
table? I can't see how that condition could compile - in its current form. You might have linked with old object files or something like that. Meaning that you current build is actually failing to produce a new MSI file, you are using an old one without noticing.
Condition: I think you have a mistake in the condition formatting, maybe try something like this:
<Condition Message="Install requires IIS 7 or higher">
<![CDATA[IISMAJORVERSION AND (IISMAJORVERSION >= "#7")]]>
</Condition>
Notice the double brackets at the end and the < and > characters at both ends and the quotes around #7. I didn't check the actual condition. Isn't it enough with the second part?
Alternatively use an escape character as shown here.
回答2:
As IISMAJORVERSION is a string we cannot perform greater than or lesser than. Hence I modified my condition to below.
<PropertyRef Id="IISMAJORVERSION"/>
<Condition Message="Installer requires IIS 6 or 7 or higher versions installed on the machine.">
<![CDATA[(IISMAJORVERSION <> "") AND (IISMAJORVERSION <> "#1") AND (IISMAJORVERSION <> "#2") AND (IISMAJORVERSION <> "#3") AND (IISMAJORVERSION <> "#4") AND (IISMAJORVERSION <> "#5")]]>
</Condition>
来源:https://stackoverflow.com/questions/52518448/wix-iis-version-check-launch-condition-not-working