Innosetup installing prerequisites

2019-07-03 23:10发布

问题:

I am creating an installer through innosetup. I see a lot of code examples on how to detect a prerequisite's existence, but nothing on how to actually go about installing the prerequisite when I don't find it. I'm sure it's blindingly simple, but how do I go about installing a prerequisite? In particular, I'm looking to install mongodb as a service as a prerequisite to my application.

回答1:

Have a look at the CodePrepareToInstall.iss example script (included with Inno) for the framework. Once you've detected that you need to do the install, at the appropriate point (shown in the script) you just ExtractTemporaryFile the installer for the prerequisite and then Exec it, checking for any errors and reboot-required-before-main-app-install conditions as needed.

For a more in-depth example for several common prerequisites (including download support), see this page.