0

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.

omargamal8
  • 551
  • 5
  • 12

1 Answers1

1

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).

Rob Mensching
  • 33,834
  • 5
  • 90
  • 130