Friday, August 3, 2018

InstallShield prerequiste "Appears to have failed" but actually worked.

I've been developing some basic MSI installation setup.exe packages that I wanted to include in a parent installer using the built in prerequisite mechanism.

Easy enough, or so I thought
  1. Create the .prq with conditions and command lines
  2. Add the .prq files to the SetupPrerequites folder
  3. Add prerequisites to the parent install project
  4. Run!
Argh! The installation appears to have failed.  Continue with the installation?

But wait, the installation didn't fail.  In fact it hadn't even finished when the error occurs.

Hmm.

Turns out, the registry setting used in the condition didn't exist at the time that the outer installer checked the value to see if the prerequisite completed successfully.

But why?  Turns out the Setup.exe was returning before the MSI was finished.  OK.

lets use the /w option

/w
Basic MSI, InstallScript MSI
For a Basic MSI project, the /w option forces Setup.exe to wait until the installation is complete before exiting.
Note: If you are using the /w option in a batch file, you may want to precede the entire Setup.exe command-line option with start /WAIT. A properly formatted example of this usage is as follows:
start /WAIT setup.exe /w

Perfect!  Right? Nope :( still not waiting.

Now what?  Lets try /clone_wait.

InstallScript
This parameter indicates that the original setup should wait for the cloned setup process to complete before exiting.

But that doesn't apply to Basic MSI projects or does it.  At this point I'll try anything.

Guess what, it worked.  Now the prerequisites install as they should.

Command that worked, for me.
cmdline="/w /clone_wait /v/qr" cmdlinesilent="/w /clone_wait /vqr"

FYI:  I'm using InstallShield 2015.