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.