I have a VS2010 WiX project with a main .wxs file and an empty .wxs file. The empty .wxs is overwritten in the prebuild event of the project, using heat.exe to harvest every
The Wix XML elements are in a namespace, so you need to specify the namespace in the match
value.
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>
Create a staging directory for the files you want to harvest with Heat. Keep the service .exe separate so you can manually author ServiceInstall.