【发布时间】:2011-10-24 15:25:47
【问题描述】:
我有一个 VS2010 WiX 项目,其中包含一个主 .wxs 文件和一个空 .wxs 文件。空的 .wxs 在项目的预构建事件中被覆盖,使用 heat.exe 从控制台 exe 中获取所有内容。该 exe 具有 InstallUtil 挂钩,并且在 VS 安装项目的日子里,该 exe 被安装为服务。
我尝试在 WiX 中使用 <ServiceInstall> 位,但是当我指定可执行文件和其他元素来安装服务时,light 抱怨主 .wxs 中的 .exe 和主 .wxs 中的 .exe 之间存在冲突产生热量的 .wxs。
我认为自定义操作不是进行服务安装的最佳方式,因此我正在尝试 XSL 转换以获取我不想要的文件(它是 100 个文件中的单个文件)。
我的 XSL 一定有问题,因为它没有匹配/过滤。这里是:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
exclude-result-prefixes="msxsl"
xmlns:Wix="http://schemas.microsoft.com/wix/2006/wi">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" />
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()" />
</xsl:copy>
</xsl:template>
<xsl:template match="
Component[File/@Source='$(var.bindir)\servicehost.exe']"/
</xsl:stylesheet>
我需要删除的 .wxs 部分如下所示:
....
<Component Id="cmpD64BE1790BFAF0F05DA37558F5D72572" Guid="{6C70DDC8-349B-4B66-A415-DE08E302C2A8}">
<File Id="fil24DFDFCA765C9A8BBB8854CE66AED0E8" KeyPath="yes" Source="$(var.bindir)\servicehost.exe" />
</Component>
....
<ComponentRef Id="cmpD64BE1790BFAF0F05DA37558F5D72572" />
....
完成这项工作的最佳方法是什么?
谢谢。
【问题讨论】:
标签: xslt wix windows-installer custom-action wix3.5