Quantcast

Windows Service installation

classic Classic list List threaded Threaded
2 messages Options
gl
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Windows Service installation

gl
This post has NOT been accepted by the mailing list yet.
This post was updated on .
Hello,
I am trying to install a WindowsService using ServiceInstall in a Component

<Component Id="ServiceInstall" Guid="D3A5B126-8B58-4130-B12A-DBC29BCA649E">   
          <ServiceInstall Id="ServiceInstaller"
                          Type="ownProcess"
                          Vital="yes"
                          Name="ServiceName"
                          DisplayName="Service Display Name"
                          Description="Service description"
                          Start="auto"
                          Account="LocalSystem"
                          ErrorControl="ignore"
                          Interactive="no">
          </ServiceInstall>
<ServiceControl Id="ServiceControl" Stop="uninstall" Remove="uninstall" Name="ServiceName" Wait="yes" />
</Component>

I've seen examples where there is a <File> with KeyPath attr set to "yes" inside the Component that points to my service executable, but my files are harvested using heat.exe which sets KeyPath="yes" for all my files and I can't seem to find an example on how to point the ServiceInstall to my .exe file.

Regards,
Piotr
gl
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Windows Service installation

gl
This post has NOT been accepted by the mailing list yet.
This post was updated on .
Hello again,
I found a solution to my problem. I used a xsl transormation to filter out my executable file from the harvested files. Then I added it to the parent component of my ServiceInstall element.

The .xslt file looks like this:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:wix="http://schemas.microsoft.com/wix/2006/wi"
  xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">

  <xsl:output method="xml" indent="yes" />

  <xsl:template match="@*|node()">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>

  <xsl:key name="exe-search" match="wix:Component[contains(wix:File/@Source, 'service.exe')]" use="@Id" />

  <xsl:template match="wix:Component[key('exe-search', @Id)]" />
  <xsl:template match="wix:ComponentRef[key('exe-search', @Id)]" />

</xsl:stylesheet>

You also need to include the path to the .xslt file in your heat.exe command with a "-t" switch e.g. "-t path\to\filter.xslt"

Regards,
Piotr
Loading...