omargamal8
omargamal8

Reputation: 601

Service not being installed properly using WIX installer

As the title says, I am have the following snippet of a code that installs a service using wix

<Directory Id="Test" Name="Test">
        <Component Id="ConnectorMainService" Guid="{SOME-ID}">
          <CreateFolder/>
          <ServiceInstall Id="ServiceInstaller" Type="ownProcess" Name="$(var.PRODUCT_NAME)" DisplayName="$(var.PRODUCT_NAME)" Description="$(var.DESCRIPTION)" Start="auto" Account="NT AUTHORITY\LocalService" ErrorControl="normal" Interactive="no" Vital="yes"/>
              <ServiceControl Id="StartService" Start="install" Stop="both" Remove="uninstall" Name="$(var.PRODUCT_NAME)" Wait="yes"/>
        </Component>
</Directory>

I had to put a <CreateFolder> in there, otherwise I have the same issues as described in this question (Why does my WiX installer need an empty CreateFolder to conditionally update an Xml file?).

The difference I have is even having the <CreateFolder> there, the installer exits without creating the service, it just creates the Folder.

Upvotes: 0

Views: 632

Answers (1)

Rob Mensching
Rob Mensching

Reputation: 36026

Replace the CreateFolder element with a File element for the service executable itself. The Windows Installer requires the service's executable File and ServiceInstall elements to be in the same Component (specifically, the service executable must be the KeyPath of the Component but WiX will take care of that for you if you put the executable File element first in the Component).

Upvotes: 1

Related Questions