我有一个安装程序,需要安装大量文件。我正在使用heat.exe来收集所有文件。这个加热命令实际上是我的构建脚本的一部分,后跟其他命令,如Candle.exe和light.exe。现在,我的应用程序test.exe也可以使用自动生成的GUID和组件ID进行收集。如何将此特定应用程序添加为防火墙例外。问题是每次我使用脚本构建安装程序时,都会生成一个带有新组件ID的新收获文件。有什么建议?
答案 0 :(得分:1)
heat
接受XSL转换参数,以您需要的任何方式修改其输出。一个简单的XSL样式表可以将元素添加到通过XPath选择的特定File
元素。
这假设test.exe
运行中只有heat
。如果不是这种情况,请修改match
属性中的XPath:
<?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'
xmlns:fire='http://schemas.microsoft.com/wix/FirewallExtension'
xmlns='http://schemas.microsoft.com/wix/2006/wi'
exclude-result-prefixes='wix'
>
<xsl:output method="xml" indent="yes" />
<xsl:template match="//wix:File[contains(@Source,'\test.exe')]">
<wix:File>
<xsl:copy-of select="@*" />
<fire:FirewallException Id='test.exe' Name='Test Server' IgnoreFailure='yes'>
<xsl:comment> localhost won't work here </xsl:comment>
<fire:RemoteAddress>127.0.0.1</fire:RemoteAddress>
</fire:FirewallException>
<xsl:apply-templates select="node()" />
</wix:File>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:template>
<xsl:template match="/">
<xsl:comment>!!!DO NOT EDIT!!! Generated by heat.exe and FirewallExceptions added.</xsl:comment>
<xsl:apply-templates />
</xsl:template>
</xsl:stylesheet>