2013-07-07 21 views
1

我有一個安裝程序,其中包含大量要安裝的文件。我正在使用heat.exe來收集所有文件。這個加熱命令實際上是我的構建腳本的一部分,後面是其他命令,如Candle.exe和light.exe。現在我的應用程序test.exe也採用自動生成的GUID和組件ID進行採集。如何將這個特定的應用程序添加爲防火牆異常。問題是,每次我使用腳本構建安裝程序時,都會使用新的組件ID生成新的收穫文件。有什麼建議麼?如何在WiX安裝程序中將應用程序添加爲防火牆例外

+0

你能不能添加customaction與'的netsh advfirewall的腳本fitewall加上'像描述這裏(http://support.microsoft .com/kb/947709) – rene

+0

其實我想試試WiXFirewallExtension。 http://wix.sourceforge.net/manual-wix3/firewall_xsd_firewallexception.htm – Durgesh

+0

在你的情況下,fileid是否穩定?在這種情況下,你確實可以使用該擴展。 – rene

回答

1

heat接受XSL轉換參數以任何您需要的方式修改其輸出。簡單的XSL樣式表可以將元素添加到通過XPath選擇的特定File元素。

這假設您的heat運行中只有test.exe。如果不是這種情況,修改的XPath在match屬性:

<?xml version="1.0" encoding="utf-8"?> 
<xsl:stylesheet version="1.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
    xmlns:wix='http://schemas.microsoft.com/wix/2006/wi' 
    xmlns:fire='http://schemas.microsoft.com/wix/FirewallExtension' 
    xmlns='http://schemas.microsoft.com/wix/2006/wi' 
    exclude-result-prefixes='wix' 
    > 
    <xsl:output method="xml" indent="yes" /> 

    <xsl:template match="//wix:File[contains(@Source,'\test.exe')]"> 
    <wix:File> 
     <xsl:copy-of select="@*" /> 
     <fire:FirewallException Id='test.exe' Name='Test Server' IgnoreFailure='yes'> 
     <xsl:comment> localhost won't work here </xsl:comment> 
     <fire:RemoteAddress>127.0.0.1</fire:RemoteAddress> 
     </fire:FirewallException> 
     <xsl:apply-templates select="node()" /> 
    </wix:File> 
    </xsl:template> 

    <xsl:template match="@*|node()"> 
    <xsl:copy> 
     <xsl:apply-templates select="@*|node()" /> 
    </xsl:copy> 
    </xsl:template> 

    <xsl:template match="/"> 
    <xsl:comment>!!!DO NOT EDIT!!! Generated by heat.exe and FirewallExceptions added.</xsl:comment> 
     <xsl:apply-templates /> 
    </xsl:template> 

</xsl:stylesheet> 
+0

有什麼問題。我正在將我的輸出放在 以下的文件中。<! - localhost在此處不起作用 - > 127.0.0.1 Durgesh

+0

不要讓放置XML命名空間前綴聲明(xmlns :...) 打擾你; XSL處理器可以將它們放置在與輸出文檔具有相同語義含義的任何地方。如果你認爲別的東西是錯的,請在你的問題中發佈這個輸出 - 它在評論中被破壞和/或不完整。 –

相關問題