2011-04-20 67 views
12

嗨我有一个使用WiX构建的MSI,它试图指定仅在安装IIS时满足的启动条件。此情况在WS2008 x64上无法正常工作。它适用于我的Windows 7 x64机器。WIX MSI,具有预先请求IIS的启动条件,在WS2008上失败

属性:

<!-- 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\InetStp\Components" 
        Name="W3SVC" /> 
</Property> 

条件:

<Condition Message="Cannot install. You must install IIS before installing this product."> 
    NOT IIS56 = "#0" OR NOT IIS7 = "#0" 
</Condition> 

(有也是IIS6的属性,但应该是这里无关紧要)。

用户正在报告他看到此“无法安装”消息。他还表示IIS已安装并正在运行。

WS2008是否具有IIS存在的不同注册表项?
什么是确定IIS是否存在的首选机制?

这是WIX 3.5。不确定确切的WS2008版本。

它可能类似于the issue described here。这个问题没有解决。

想法?

回答

30

为什么不直接使用Wix IIS扩展和IISMAJORVERSION和IISMINORVERSION?

我们使用他们,我知道他们对我们从XP使用的每个版本的Windows工作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> 
+2

+1。 @Cheeso,你正在用这种方法重新发明轮子。 – 2011-04-21 07:55:07

+0

我从某个地方的wix bboard帖子中获得了该方法。它工作了一段时间。 – Cheeso 2011-04-25 20:36:03

+0

正如一个侧面说明。当我删除I​​IS角色时,我仍然得到ISSMajorversion,因此它不是100%保存以检查是否安装了IIS。 – uli78 2013-05-03 11:44:43

-2

维克斯3.5不支持检查IIS版本的IIS 7.0及以上。

我建议您调用自定义操作来检查IIS版本,然后在此基础上执行操作。

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")); 
} 

然后在regKey的基础上,您可以设置变量。

+0

这不是事实,他们已经有几个月的IIS 7.5支持,可能已经接近一年了。 – 2011-05-04 18:37:19

+0

@Rob:你可以请张贴相同的代码吗? – 2011-05-09 12:56:57

+0

我在上面的答案中添加了一个片段 – 2011-05-09 20:40:07