control a service on uninstall
Posted 17 March 2010 - 23:22
I am writing setups for several applications (products) that share some "common" components. I have put these common components into a merge module.
These common components include a Windows service which should be stopped before file transfer and restarted afterwards both on installation and uninstallation of a product, because it uses some files to be overwritten/deleted.
So I created the corresponding ServiceControl entries in the merge module. As a result, if more than one product has been installed and the user wants to deinstall one of them, the event "Stop the service on uninstall" is not executed, because the component containing the ServiceControl has another reference and is not deinstalled.
I think the only solution would be to create a component containing the (identical) ServiceControl entries for each product, so that each product deinstallation uninstalls one of these components (and stops the service) independently of the other products.
BTW, I cannot just add the ServiceControl entries to components copying the files that may be used by the service, because the user can select an installation with or without service, and the ServiceControl component is only to be installed for installations with service, whereas the files are to be installed indepently of the service.
Is there any other "clean" way out of this problem?
Posted 18 March 2010 - 20:31
The uninstall log file says:
MSI (s) (68:D4) [08:35:26:976]: Component: ControlService; Installed: Local; Request: Absent; Action: FileAbsent
which means that this uninstall does not touch the non-file resources (including the ServiceControl) of this component.
BTW: The FileAbsent is only because the key of this component is the INSTALLDIR of each product.
Posted 22 March 2010 - 09:40
Posted 22 March 2010 - 09:47
this is true for the ServiceInstall table.
However, for the ServiceControl table, the Windows Installer documentation does not say so, and I do not think it would make sense.
If ServiceControl required the key path of its component to be the service executable, it would not be possible to control (i.e. stop/start) a service which is not installed by the current installation.
Posted 22 March 2010 - 13:28
I think this is not a resource to be permanently installed or removed but just some set of commands to be executed on installation or uninstallation.
There are several products using a third-party service, and for installation and uninstallation of each of these products it is necessary to stop this service, because it locks some files to be installed/removed.
Do you see a "component-safe" solution apart from custom actions?
Or any side-effects that do not also happen with custom actions?
Posted 22 March 2010 - 18:11
Posted 23 March 2010 - 14:40