Sno*_*owy 6 xslt windows-installer custom-action wix wix3.5
我有一个VS2010 WiX项目,主要是.wxs文件和一个空的.wxs文件.在项目的prebuild事件中覆盖空的.wxs,使用heat.exe从控制台exe收集所有内容.exe有InstallUtil挂钩,在VS安装项目的时代,exe作为服务安装.
我尝试使用<ServiceInstall>WiX中的位,但是当我指定可执行文件和其他元素来安装服务时,轻抱怨主.wxs中的.exe与热量生成的.wxs中的.exe之间的冲突.
我认为自定义操作不是进行服务安装的最佳方式,因此我尝试使用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>
Run Code Online (Sandbox Code Playgroud)
我需要撕掉的部分.wxs看起来像这样:
....
<Component Id="cmpD64BE1790BFAF0F05DA37558F5D72572" Guid="{6C70DDC8-349B-4B66-A415-DE08E302C2A8}">
<File Id="fil24DFDFCA765C9A8BBB8854CE66AED0E8" KeyPath="yes" Source="$(var.bindir)\servicehost.exe" />
</Component>
....
<ComponentRef Id="cmpD64BE1790BFAF0F05DA37558F5D72572" />
....
Run Code Online (Sandbox Code Playgroud)
使这项工作的最佳方法是什么?
谢谢.
Wix XML元素位于命名空间中,因此您需要在match值中指定命名空间.
我通过使用XSL将ServiceInstall和ServiceControl元素添加到由heat以下内容生成的片段中解决了同样的问题:
<!-- Add the service install/control entries to mybinary.exe -->
<xsl:template match="wix:Component[contains(wix:File/@Source,'mybinary.exe')]">
<xsl:copy>
<xsl:apply-templates select="node() | @*" />
<wix:ServiceInstall Id="MyServiceInstall" DisplayName="[SERVICE_NAME]" Description="[SERVICE_DESC]" Name="MyService" Arguments="" ErrorControl="normal" Start="auto" Type="ownProcess" Vital="yes" Account="LocalSystem" />
<wix:ServiceControl Id="MyServiceControl" Name="MyService" Start="install" Stop="uninstall" Remove="uninstall" />
</xsl:copy>
</xsl:template>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2620 次 |
| 最近记录: |