Reputation: 73
I am new to WiX but I have done some stuff with Installshield and the Windows Installer in the past.
I have what I think is a fairly simple installer that sets up a windows service. It sets it up under the "NT AUTHORITY\NETWORK SERVICE" if that makes a difference.
Install works fine, but during uninstall I get a prompt telling me this "The setup must update files or services that cannot be updated when the system is running. If you choose to continue, a reboot will be required to complete the setup.". If I click okay everything is uninstalled except the service (even after a reboot). It is still started and the exe associated with the service is left behind too.
I can manually stop and remove the service without a problem with the sc.exe command.
Also if I had the service manually stopped before I run the uninstall I do not get the above mentioned prompt but the result is still the same. The service is left and so is the file.
Here is part of my Wix:
<Component Id='cmpService' Guid='{542f970e-ca39-4501-aae4-9e03eaac9a25}' >
<File Id='ServiceExeFile' Name='nls.service.agent.exe'
ReadOnly='no' Compressed='yes' KeyPath='yes' Vital='yes' Hidden='no' System='no'
Checksum='no' />
<ServiceInstall Id='MyServiceInstall' DisplayName='RaMP Data Collector' Name='rampDataCollector'
ErrorControl='normal' Start='auto' Type='ownProcess' Vital='yes'
Account='NT AUTHORITY\NETWORK SERVICE' />
<ServiceControl Id='MyServiceControl' Name='rampDataCollector'
Start='install' Stop='uninstall' Remove='uninstall' Wait='yes' />
</Component>
I have tried
Here are pieces from the msi log from when I run the uninstall and the service is manually stopped first. I pasted the parts around the service component and MSI actions.
MSI (s) (A4:58) [10:44:11:080]: Component: cmpService; Installed: Local; Request: Absent; Action: Null
MSI (s) (A4:58) [10:44:11:080]: Component: cmpFolderPermissions; Installed: Local; Request: Absent; Action: Absent
MSI (s) (A4:58) [10:44:11:080]: Component: cmpApplicationShortcut; Installed: Local; Request: Absent; Action: Absent
AND
MSI (s) (A4:58) [10:44:11:876]: Doing action: StopServices
Action ended 10:44:11: SchedSecureObjectsRollback. Return value 1.
Action start 10:44:11: StopServices.
MSI (s) (A4:58) [10:44:11:878]: Doing action: DeleteServices
Action ended 10:44:11: StopServices. Return value 1.
Action start 10:44:11: DeleteServices.
MSI (s) (A4:58) [10:44:11:879]: Doing action: RemoveRegistryValues
Action ended 10:44:11: DeleteServices. Return value 1.
Any help would be appreciated.
I guess as a last resort I could do a custom action and stop/remove the service at uninstall using the sc command.
Upvotes: 4
Views: 6538
Reputation: 55620
You should understand that the service commands don't occur when the installer is uninstalled but when the component is uninstalled. As the log says, no action is being taken.
This can happen if you do things like break the component rules or service the application outside of the installer and mess up component/file reference counts.
For example, if foo.exe existed and then MSI installed foo.exe, it would get left behind on uninstall. Therefore the service associated with it would also.
Upvotes: 2