lionelsiu
Posts: 19
Joined: Fri Jul 26, 2013 4:11 am

Run custom action before Prerequisites dialog

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.
Dan
Posts: 4513
Joined: Wed Apr 24, 2013 3:51 pm

Re: Run custom action before Prerequisites dialog

Hello,

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.

Please let us know if that helped.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Eternal21
Posts: 21
Joined: Mon Aug 15, 2016 5:51 pm

Re: Run custom action before Prerequisites dialog

However, you can try to create another package that will stop the related service.
Can you clarify that solution? How do I stop the service from another package?

I have the exact same problem as the OP. I need to stop a service, because one of the prerequistes is writing over it.
Dan
Posts: 4513
Joined: Wed Apr 24, 2013 3:51 pm

Re: Run custom action before Prerequisites dialog

Hello,
Can you clarify that solution? How do I stop the service from another package?

I have the exact same problem as the OP. I need to stop a service, because one of the prerequistes is writing over it.
Is the related prerequisite added as a Pre-Install prerequisite?

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Eternal21
Posts: 21
Joined: Mon Aug 15, 2016 5:51 pm

Re: Run custom action before Prerequisites dialog

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.

Return to “Building Installers”