2011-04-20 68 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