December 2012
Intermediate to advanced
488 pages
10h 23m
English
The ServiceInstall element works well for installing a service, but doesn't provide a way to start, stop, or uninstall one. For that, you'll use the ServiceControl element. It can be added to the same component as the ServiceInstall element thereby sending signals to the testsvc test service you're installing.
The following example starts the service during install and stops and removes it during uninstall. These actions happen during the deferred stage of the Execute sequence:
<DirectoryRef Id="INSTALLFOLDER"> <Component ... > <File ... /> <ServiceInstall ... /> <ServiceControl Id="sc_WindowsService1" Name="testsvc" Start="install" Stop="both" Remove="uninstall" Wait="yes" /> </Component> </DirectoryRef> ...
Read now
Unlock full access