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.
Re: launching a custom action before prerequisite?
Beware of the silent installation
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+"
msiexec /i "YourMsiPackage.msi" /qn+
and you will realize that the prereqs were not installed.
Re: Beware of the silent installation
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.