Is it possible to run a custom action before Pre-install Prerequisites? I want to stop a Windows Service before installing the prerequisites in pre-install sequence.
Unfortunately this cannot be achieved.
However, you can try to create another package that will stop the related service. You can add this package as a pre-install one, before your prerequisite from the main application.
Also you should disable the "Register product with Windows Installer" option from the "Product details" page.
Basically I have a service packaged as an MSI, let's call it MyService.msi. It's one of the 'Pre-install' prerequisites inside my Advanced Installer build, MyAdvancedBuild.exe, which contains many other MSI's.
Now when I run the MyAdvancedBuild.exe on a target computer, if it already had MyService.msi installed and running, it will return an error, because the service needs to be stopped first.
I was hoping I can just do it with a custom action, but as the first response in this thread states, custom actions can't run before prerequisites. So I'm looking for a workaround, because right now, you need to manually stop the service for the install to work.
EDIT 1: Would installing the service as Post-install prerequiste work? I don't need it running before other applications.
EDIT 2: So I tried moving the MyService.msi prerequisite to Post-installs. I then added a custom action to stop the service. It looks like it works, because the service gets stopped. The problem is, that I only want to stop the service, if I need to update it. Because otherwise the installer will stop the service, and never start it again. How would I add a condition to a custom action, based on whether a post-install prerequisite is required or not? Alternately, I could always stop the service, as long as there was a way for me to always start a service after post-install prerequisites are done. But I'm guessing that won't be possible.