An important part of many application installs is configuring windows services. WiX has the ability to install/uninstall as well as start and stop services during instalation.
The first element we need to set up is the ServiceInstall element. ServiceInstall controls how the service will start and what user and authentication are to be used. Note that the ServiceInstall element does not specify a file. Rather the file that has KeyPath="yes" set in the same component is considered the executable to use as a service.
The ServiceInstall element lets you configure the following:
Type specifies how the service should run, either running as its own process or as a shared process. Note that while kernalDriver and systemDriver are allowed values they are not currently supported by Windows Installer.
This enumeration determines what WiX should do if the service causes an error.
The start enumeration determines how the service should be started. These are the standard service start up options (as found in the services applet).
A sample ServiceContol appears below:
Both the ServiceControl and ServiceInstall elements are nested within a *Component * element. The service is installed and started (or stopped and uninstalled) at the time that the component is installed.
To conclude WiX provides a simple way for installing and setting up Windows Services, and ensuring they are cleanly uninstalled along with the rest of the program being uninstalled.