Creating Services with WiX
Overview
Creating a service is actually fairly easy and straightforward. No, really, it is actually quite good, especially because you can guarantee that your service is running after the setup, and gets shutdown before uninstall. You only need to have an existing file component that is the main executable of your service. The rest is a piece of cake:
Example:
Let's say I have this fine file:
<Component Id='bin_paserver_exe' Guid='YET ANOTHER GUID GOES HERE'>
<File Id='bin_paserver_exe_file' Name='PASERVER.EXE' DiskId='1' Source='BIN\PASERVER.EXE' Vital='yes'/>
...
</Component>
All you need to add its two tags, like this:
<Component Id='bin_paserver_exe' Guid='YET ANOTHER GUID GOES HERE'>
<File Id='bin_paserver_exe_file' Name='PASERVER.EXE' DiskId='1' Source='BIN\PASERVER.EXE' Vital='yes'/>
<ServiceInstall Id="ServiceInstaller" Type="ownProcess" Vital="yes" Name="PASERVER" DisplayName="ProAKT Server" Start="auto" Account="LocalSystem" ErrorControl="ignore" Interactive="no"/>
<ServiceControl Id="StartService" Start="install" Stop="both" Remove="uninstall" Name="PASERVER" Wait="yes" />
</Component>
Both are pretty much self explaning, but if you insist, the reference documentation is here: