2013-07-15 47 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> 
相关问题