2013-07-15 52 views
1

我正在爲Web應用程序創建一個WIX設置。我使用安裝程序wix add-in以非常快的速度執行此操作。但是,如何將web.config排除在目錄之外?如何從WIX設置中排除web.config

我不想在所有的.config文件上使用過濾器,只是在web.config上使用過濾器。謝謝。

我創建了一個名爲WebApplicationWix的測試項目。

+0

你可以去威克斯projext的XML和簡單的刪除條目(文件本身和安裝命令)爲你的web.config –

+1

,您拍攝的路線(新vdproj轉換爲WiX的使用工具)帶有很多包袱和複雜性。我建議你從一個簡單的WiX項目開始。 –

+0

@Tom嗯,這確實讓我花了很多時間讓所有的東西都起作用,但我估計比從頭開始的時候少。我是WIX新手,我閱讀了文檔,但很困難。您是否從頭開始爲Web應用程序和引用的類庫提供測試項目?你可以改變我的測試項目。 –

回答

2

只需在變換中的過濾器中更具體。請記住,過濾器是在SRC值上完成的。

E.g. wix:Component [contains(wix:File/@ Source,'* .config')] to wix:Component [contains(wix:File/@ Source,'$(var.HostFileDir)\ Web.config' )]

<?xml version="1.0" encoding="utf-8" ?> 
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
       xmlns:msxl="urn:schemas-microsoft-com:xslt" 
       exclude-result-prefixes="msxl" 
       xmlns:wix="http://schemas.microsoft.com/wix/2006/wi"> 

    <xsl:output method="xml" version="1.0" encoding="utf-8" indent="yes" /> 
    <xsl:strip-space elements="*" /> 

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

    <!-- Match and ignore Web.Config file--> 
<xsl:key name="config-search" match="wix:Component[contains(wix:File/@Source, '$(var.HostFileDir)\Web.config')]" use="@Id" /> 
    <xsl:template match="wix:Component[key('config-search', @Id)]" /> 
    <xsl:template match="wix:ComponentRef[key('config-search', @Id)]" /> 

</xsl:stylesheet> 
相關問題