1

我正在过滤我项目中的所有 .pdb 文件。在互联网上,我看到了几个如何使用 XSLT 执行此操作的示例(因为我不是 XSLT 大师,所以我复制了一些并尝试了一些)。当我有以下 XSLT 脚本时:

<?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">
  <xsl:output method="xml" indent="yes" />
  <xsl:template match="@*|node()">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>
  <xsl:key name="service-search" match="wix:Component[contains(wix:File/@Source, '.pdb')]" use="@Id" />
  <xsl:template match="wix:ComponentRef[key('service-search', @Id)]" />
</xsl:stylesheet>

但是当我使用预构建事件命令执行此操作时:

call "C:\Program Files (x86)\WiX Toolset v3.6\bin\heat.exe" dir "..\bin" -t Filter.xslt -sfrag -cg "WebBinaries" -gg -srd -var "var.$(ProjectName).TargetDir" -dr "WebBin" -out "$(SolutionDir)\Deployment\$(ProjectName).binaries.wxs"

我收到以下错误:找到孤立组件......对 pdb 文件的引用已正确删除,但对已删除组件的引用仍然存在

当我改变

<xsl:template match="wix:ComponentRef[key('service-search', @Id)]" />

<xsl:template match="wix:ComponentRef[key('service-search', @Id)]" />

我收到另一个错误:未解析的对符号的引用............在部分片段中

有谁知道如何解决这个问题?

提前致谢

4

1 回答 1

3

我用以下 xslt 修复了它:

<?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">
  <xsl:output method="xml" indent="yes" />
  <xsl:template match="@*|node()">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>
  <xsl:key name="service-search" match="wix:Component[contains(wix:File/@Source, '.pdb')]" use="@Id" />
  <xsl:template match="wix:Component[key('service-search', @Id)]" />
  <xsl:template match="wix:ComponentRef[key('service-search', @Id)]" />
</xsl:stylesheet>
于 2012-12-12T20:37:42.110 回答