如何使用Wix Heat忽略.svn目录?

12

我正在使用Heat工具生成Wix标记,以在我的安装程序中包含大量文件和文件夹。这一切都运行良好,但我刚刚意识到,自从我将源文件夹添加到我的Subversion存储库中,Heat也想包含.svn文件夹。

有没有办法告诉Heat不要收集与给定标准匹配的文件或文件夹?

我目前正在使用Wix 3.5。


我只安装了3.0版本,所以可能有更好的方法,但你可以使用heat -t并提供一个XSL样式表来剥离.svn下的任何内容。 - anton.burger
谢谢Anton。我也看到了那个选项,所以会去看一下。 - Alan Spark
3个回答

13

以下是我使用的方法:

<?xml version="1.0" ?>
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:wix="http://schemas.microsoft.com/wix/2006/wi">

    <!-- Copy all attributes and elements to the output. -->
    <xsl:template match="@*|*">
        <xsl:copy>
            <xsl:apply-templates select="@*" />
            <xsl:apply-templates select="*" />
        </xsl:copy>
    </xsl:template>

    <xsl:output method="xml" indent="yes" />

    <!-- Create searches for the directories to remove. -->
    <xsl:key name="svn-search" match="wix:Directory[@Name = '.svn']" use="@Id" />
    <xsl:key name="tmp-search" match="wix:Directory[@Name = 'tmp']" use="@Id" />
    <xsl:key name="prop-base-search" match="wix:Directory[@Name = 'prop-base']" use="@Id" />
    <xsl:key name="text-base-search" match="wix:Directory[@Name = 'text-base']" use="@Id" />
    <xsl:key name="props-search" match="wix:Directory[@Name = 'props']" use="@Id" />

    <!-- Remove directories. -->
    <xsl:template match="wix:Directory[@Name='.svn']" />
    <xsl:template match="wix:Directory[@Name='props']" />
    <xsl:template match="wix:Directory[@Name='tmp']" />
    <xsl:template match="wix:Directory[@Name='prop-base']" />
    <xsl:template match="wix:Directory[@Name='text-base']" />

    <!-- Remove Components referencing those directories. -->
    <xsl:template match="wix:Component[key('svn-search', @Directory)]" />
    <xsl:template match="wix:Component[key('props-search', @Directory)]" />
    <xsl:template match="wix:Component[key('tmp-search', @Directory)]" />
    <xsl:template match="wix:Component[key('prop-base-search', @Directory)]" />
    <xsl:template match="wix:Component[key('text-base-search', @Directory)]" />

    <!-- Remove DirectoryRefs (and their parent Fragments) referencing those directories. -->
    <xsl:template match="wix:Fragment[wix:DirectoryRef[key('svn-search', @Id)]]" />
    <xsl:template match="wix:Fragment[wix:DirectoryRef[key('props-search', @Id)]]" />
    <xsl:template match="wix:Fragment[wix:DirectoryRef[key('tmp-search', @Id)]]" />
    <xsl:template match="wix:Fragment[wix:DirectoryRef[key('prop-base-search', @Id)]]" />
    <xsl:template match="wix:Fragment[wix:DirectoryRef[key('text-base-search', @Id)]]" />
</xsl:stylesheet>

+1 这是我用来过滤代码合同目录的相同解决方案。 - Lukazoid
1
如果出现“未解决符号引用错误”,请将 use="@Id" 更改为 use="descenddant::wix:Component/@Id",如此处所述。 - dwp4ge
1
我认为这个问题的更好解决方案在这里提供:https://dev59.com/Kl7Va4cB1Zd3GeqPOe9H#9163895 - Roger Sanders

12

不幸的是,今天你必须使用XSL转换来过滤掉“噪音”。这是一个针对Heat的功能请求。


1
好的,谢谢Rob。能够做到这一点肯定会很有用。 - Alan Spark
1
我看了你的答案,想知道如何在Heat.exe生成的WXS上应用XSL。所以,如果有人也在寻找这个问题的解决办法,你只需要使用Heat.exe -t标志即可。参见:http://stackoverflow.com/questions/8034798/wix-installer-using-xslt-with-heat-exe-to-update-attributes http://wixtoolset.org/documentation/manual/v3/overview/heat.html - MichaelS

1
Subversion 1.7已经发布,将元数据存储集中为每个工作副本的单个.svn文件夹。因此,我怀疑如果您简单地升级您的SVN客户端,您的问题将会消失。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接