【问题标题】:WiX 3.6 filtering with XSLT使用 XSLT 进行 WiX 3.6 过滤
【发布时间】:2012-12-11 22:52:19
【问题描述】:

我正在过滤我的项目中的所有 .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)]" />

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

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

提前致谢

【问题讨论】:

    标签: wix wix3.6


    【解决方案1】:

    我用以下 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>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-09-13
      • 2014-05-20
      • 1970-01-01
      • 2012-07-16
      • 1970-01-01
      • 1970-01-01
      • 2023-02-08
      • 1970-01-01
      相关资源
      最近更新 更多