Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

control a service on uninstall


8 replies to this topic

Matthias1967

Matthias1967
  • Full Members
  • 92 posts

Posted 17 March 2010 - 23:22

Hello,

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?

Best regards,

Matthias

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 18 March 2010 - 13:42

You could try setting the serive to be stopped not only during uninstall but also during install.

Matthias1967

Matthias1967
  • Full Members
  • 92 posts

Posted 18 March 2010 - 20:31

The ServiceControl entry has the flags "Stop on Install" and "Stop on Uninstall" set - just because I need to stop the service when an install overwrites files used by the service. The problems I mentioned in my original post occur on uninstall if more than one product uses this component.

The uninstall log file says:

CODE

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.

Best regards,

Matthias

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 22 March 2010 - 09:40

I don't know if that's related to your problem, but in general for services the executable of the service must be the key path of the component.

Matthias1967

Matthias1967
  • Full Members
  • 92 posts

Posted 22 March 2010 - 09:47

Hello Stefan,

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.

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 22 March 2010 - 10:13

True, but your service file still violates the component rules, which could cause any sort of problem.

Matthias1967

Matthias1967
  • Full Members
  • 92 posts

Posted 22 March 2010 - 13:28

So you are turning to the question whether a ServiceControl entry is a "resource"?
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?

Regards,

Matthias



Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 22 March 2010 - 18:11

I'm not traing to turn this question into anything. I just tried to point out one thing that you may want to try to see if it helps smile.gif

Matthias1967

Matthias1967
  • Full Members
  • 92 posts

Posted 23 March 2010 - 14:40

Ok, so where (or where else) does this component violate component rules?