且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

WiX 3.5从Heat安装服务,是否需要自定义操作?

更新时间:2022-06-02 00:50:29

Wix XML元素位于名称空间中,因此您需要在 match 值中指定名称空间。

The Wix XML elements are in a namespace, so you need to specify the namespace in the match value.

我通过使用XSL添加了 ServiceInstall ServiceControl 元素到 heat 生成的片段中:

I solved the same problem by using XSL to add in the ServiceInstall and ServiceControl elements to the fragment generated by 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>