Search code examples
wixburnwix3.11

What's the best way to start/stop a windows service before install/uninstall?


I currently have a bootstrapper wix project that contains two msi projects. I'm trying to figure out the best way to do the following on installation/uninstallation/modify/repair.

  1. Prompt user that the proceeding will restart a critical windows service
  2. If no is selected, abort installer
  3. If yes is selected, stop service
  4. Run through the appropriate sequence to install/uninstall/etc with all the msi files in the chain
  5. Once the chain of msi files is complete, start the windows service again.

It seems a custom action is in order (in each msi project) however I have yet to figure out the best way to only show the confirmation prompt one time (instead of once per msi) and also how to ensure the first msi doesn't restart the windows service and that the last msi does restart the windows service.

Essentially both msi projects require that a windows service be stopped before installation/uninstallation/etc although it should be restarted when the installer is complete. Ideas?


Solution

  • I ended up getting creative with a custom action to prompt the user at the correct point in the install/uninstall/etc flow which would then stop the service then start it back up after dealing with all MSIs in the chain.