WIX MSI that has a Launch Condition to pre-req IIS, fails on WS2008
Hey I have an MSI, built with WiX, that attempts to specify a launch condition that is satisfied only when IIS is installed. This condition is not working as desired on WS2008 x64. It works on my Windows 7 x64 machine.
The property:
<!-- This is used later in a Launch condition. -->
<!-- see http://learn.iis.net/page.aspx/135/discover-installed-components/ -->
<Property Id="IIS7" Value="#0">
<RegistrySearch Id="IIS7W3SVC"
Type="raw"
Root="HKLM"
Key="SOFTWARE\Microsoft\In开发者_高级运维etStp\Components"
Name="W3SVC" />
</Property>
The condition:
<Condition Message="Cannot install. You must install IIS before installing this product.">
NOT IIS56 = "#0" OR NOT IIS7 = "#0"
</Condition>
(there is also a property for IIS6, but that should be irrelevant here).
A user is reporting that he is seeing this "cannot install" message. He also says that IIS is installed and functioning.
Does WS2008 have a different registry key for IIS presence?
What is the preferred mechanism to determine if IIS is present?This is WIX 3.5. Not sure of the exact WS2008 version.
It might be similar to the issue described here. That question is unresolved.
ideas?
Why not just use the Wix IIS extensions and IISMAJORVERSION and IISMINORVERSION?
We use them and I know they work on every version of windows we've used from XP to 2008R2
<!-- Reference WixIIsExtension in project and pull in property by ref -->
<PropertyRef Id="IISMAJORVERSION"/>
<Condition Message="Install requires IIS 6 or 7.">
<![CDATA[Installed OR (IISMAJORVERSION AND (IISMAJORVERSION = "#6" OR IISMAJORVERSION = "#7"))]]>
</Condition>
WIX 3.5 is not supporting for checking IIS version for IIS 7.0 and above.
I would suggest you to call a custom action to check the IIS version and then perform actions on that basis.
RegistryKey regKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\InetStp");
if (regKey != null)
{
string IISVersion = Convert.ToString(regKey.GetValue("MajorVersion")) + "." + Convert.ToString(regKey.GetValue("MinorVersion"));
}
Then on the basis of the regKey you can set the variables.
精彩评论