Adding service dependencies

If your service requires that other services be started before it can function properly, you can use the ServiceDependency element to add those services as dependencies. You'll place it inside the ServiceInstall element. Here's an example that states that the DNS Client service, named Dnscache, must be started before starting our Test Service:

<ServiceInstall 
   Id="InstallWindowsService1" 
   Name="testsvc" 
   DisplayName="Test Service" 
   Description="Test service for WiX"
   Start="auto"
   ErrorControl="normal"
   Type="ownProcess">

   <ServiceDependency Id="Dnscache" />
</ServiceInstall>

The ServiceDependency element's Id attribute sets the name of the service to depend on. Now, Windows will make sure that the DNS Client service is started ...

Get WiX 3.6: A Developer's Guide to Windows Installer XML now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.