cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Nightmare1723
Level 3

launching a custom action before prerequisite?

Hi

Does anyone know how to launch a custom action before a prerequisite?

Thanks
Labels (1)
0 Kudos

(5) Replies
Reureu
Level 10

Hi,

The problem is: If your prerequisites are set to be installed before your feature selection, then setup.exe checks which prereqs must be installed and performs the installation accordingly. Hence, the prereqs are installed before launching the installation using your MSI file and before one of your sequence is executed.

So, if your prerequisites are set to be installed before feature selection, then you cannot do this. A workaround would consist of using feature prerequisites.

On the prerequisite view, choose the prerequisite you need to install, and uncheck the "Install before feature selection" box. All the features should then be checked, which means the prereqs will be installed as long as one feature is selected for installation.

This will schedule an ISInstallPrerequisites in the UI sequence (No idea why it only adds this custom action to the UI sequence, but that should be the subject of a different thread).
You can then add your custom action before ISInstallPrerequisites.


If you don't want to use feature prerequisites, another workaround consists of creating a bootstrapper (like a simple InstallScript project) that calls your main setup.
You can implement anything you want in your bootstrapper, then call the executable of your installation package from the bootstrapper.
The drawback of this second approach is that it somewhat limits the interaction with your main installation package.

I hope that helps.

Regards
0 Kudos
cbragg
Level 7

Unfortunately you can't do that. It's a pre-requesite so it runs before your installation. If this pre-req is not used by your installer (like .NET for a .Net custom action for instance) then you may want to look into chained MSIs. Any chained MSI runs after your installation or if your pre-req isn't an msi based install then just install it as an exe custom action
0 Kudos
Nightmare1723
Level 3

thanks to all!

I assigned the prerequisite to a feature and it resolved my problem.
0 Kudos
Reureu
Level 10

Hi,

Glad it did the job.
But as mentioned, remember that the prerequisites will NOT be installed if somebody launches your setup in silent mode...

You can try one of the following command
setup.exe /s /v"/qn+"

or
msiexec /i "YourMsiPackage.msi" /qn+

and you will realize that the prereqs were not installed.

Regards
0 Kudos

Thats all great I use feature prerequisites only. The question originally asked here was HOW do you run a custom action BEFORE these feature prerequisites are installed. For some really bizarre reason the ISInstallPrerequisites step is in the user interface sequence and no explanation to why this is has been offered by anyone. If you go for the obvious option of inserting your "deferred" custom action immediately after InstallInitialize then you're out of luck. Prerequisites have already been installed. If your custom action must run in deferred execution then it really does seem that this is unachievable. Windows Installer + Basic MSI is sadly a black art which requires some insight into the possibly warped minds of its creators in order to be able to work with it - and stick to working within its limitations you must! Anyway lets say that your custom action is going to take some time to execute (its going to access the internet and download some stuff which might take ages over a slow satellite link) so lets go with the next best thing make it a synchronous in the user interface sequence. Yes that really sounds like a great idea!!! REALLY well I'm just going to give that a try and see if I can get the progress bar to work. Somehow it seems doubtful. Can anyone offer a better solution or maybe someone can tell me how to update the main progress bar without using a deferred custom action.

0 Kudos