Search happens before Prerequisites - Advanced Installer Community
williamssi
Posts: 4
Joined: Tue Sep 20, 2016 8:39 pm

Search happens before Prerequisites

Hi,

I want my installer to Install JDK and Tomcat as prerequisites, which is working fine.
I then want to install my webapp into tomcat. I have created a 'Folder Search' under Custom Behavior which finds tomcat in Program Files and uses that as the location to install my app.
This works if Tomcat is already installed, but fails if Tomcat is installed as a prerequisite because the search is run before the prerequisite install.

I don't really want to move the tomcat install to the pre-install section as this will mean moving JDK too, and will result in my installer taking ages before displaying any dialogs.

Is there anyway to delay, or rerun the search after the prerequisites are installed?

Thanks in advance.
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Search happens before Prerequisites

Hello,

Indeed the “Searches Action Group” are run before installing feature-based prerequisites. Although you can't change the execution order, you can use as a workaround your own custom action which searches the Tomcat folder and set the path to a property.

For instance, this can be done using an “Execute Script Code” custom action (from “Custom Actions” page in the “Custom Behavior” section) with sequence after “Install Execution Stage -> Searches" action group. Here you can run a script or an application to find the installation folder for Tomcat. In the sample project attached here we use a VB script to validate the Tomcat installation path and store the path in a "FOLDER" property.

Let us know if this helped.

All the best,
Daniel
Attachments
Case.aip
(12.53 KiB) Downloaded 314 times
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
williamssi
Posts: 4
Joined: Tue Sep 20, 2016 8:39 pm

Re: Search happens before Prerequisites

Thanks Daniel, I will give that a try. looks like a good solution
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Search happens before Prerequisites

You're welcome.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
williamssi
Posts: 4
Joined: Tue Sep 20, 2016 8:39 pm

Re: Search happens before Prerequisites

Just a quick update. I managed to get this working, but had a few issues.

I wanted to check for tomcat inside Program Files, and Program Files (x86) but as these paths are configurable I wanted to use the Windows environment variables to find them. However Advanced Installer changes the variable PROGRAMFILES to be "C:\Program Files (x86)" and so I could not get that to work.
I changed tack and queried the windows registry to find the tomcat install location. I had to duplicate the script, one for x86 and one for x64 to ensure the 64bit registry is queried

The other issue I had was that the parameter being set by the script is used to install files, and so it has to be initialised to a valid path, otherwise it causes an error at startup. Unfortunately, there is no way to initialise it to a dynamic folder path, so I have to assume C: will be available and set it to C:\

But I'm happy it's working now

Thanks again.
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Search happens before Prerequisites

Hello,

Thank you for your follow up.

Please note that there is no need to initialize your folder property with a hard coded path (i.e. "C:\"). To achieve what you want you can use a "Set installer property" custom action to set your folder property to the "WindowsVolume" property value. Just go to "Custom Actions" page and before "Wizard Dialogs Stage -> Paths Resolution" action group add a "Set installer property" custom action like this:
  • Property: MY_FOLDER_PROP
    Value: [WindowsVolume]
Then just drag, while keeping the [SHIFT] key pressed, the above custom action under the "Install Execution Stage" just before "Paths Resolution" action group. In this way the custom action will be shared between both execution stage. You will need this because during a silent installation only the "Install Execution Stage" is performed. Also, in the "Advanced execution scenarios..." option choose the "Skip action in Install Execution Stage if executed in Dialogs Stage" option.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”