xslt – WiX 3.5从热门安装服务,需要自定义动作吗?
发布时间:2020-12-13 20:40:00 所属栏目:Windows 来源:网络整理
导读:我有一个带有主.wxs文件的VS2010 WiX项目和一个空的.wxs文件.在项目的prebuild事件中覆盖空的.wxs,使用heat.exe从控制台exe收集所有内容. exe有InstallUtil挂钩,在VS安装项目中,exe作为服务安装. 我试图使用 ServiceInstall WiX中的位,但是当我指定可执行文
我有一个带有主.wxs文件的VS2010 WiX项目和一个空的.wxs文件.在项目的prebuild事件中覆盖空的.wxs,使用heat.exe从控制台exe收集所有内容. exe有InstallUtil挂钩,在VS安装项目中,exe作为服务安装.
我试图使用< ServiceInstall> WiX中的位,但是当我指定可执行文件和其他元素来安装服务时,light抱怨主.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> 我需要撕掉的.wxs的部分看起来像这样: .... <Component Id="cmpD64BE1790BFAF0F05DA37558F5D72572" Guid="{6C70DDC8-349B-4B66-A415-DE08E302C2A8}"> <File Id="fil24DFDFCA765C9A8BBB8854CE66AED0E8" KeyPath="yes" Source="$(var.bindir)servicehost.exe" /> </Component> .... <ComponentRef Id="cmpD64BE1790BFAF0F05DA37558F5D72572" /> .... 这项工作的最佳方法是什么? 谢谢.
Wix XML元素位于命名空间中,因此您需要在匹配值中指定命名空间.
我通过使用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> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
推荐文章
站长推荐
- windows-server-2008-r2 – 没有源IP的事件ID 46
- character-encoding – Go:使用windows-1252编码
- windows-7 – Windows 10上的ISCSI性能降低
- Windows – 如何将多个文件名传递给上下文菜单Sh
- Windows批处理 – 删除隐藏文件
- win10 装centos7 虚拟机
- windows-server-2008-r2 – 撤消R2上的替换任务管
- windows-8 – 如何在Windows 8.1(IE11和Modern U
- windows-server-2003 – Server 2003缺少NETLOGO
- windows-server-2008 – ADFS 2.0场 – 如何执行
热点阅读