3

I am creating an installer through Inno Setup. 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.

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
kanders-fatpot
  • 141
  • 3
  • 5

1 Answers1

2

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.

TLama
  • 75,147
  • 17
  • 214
  • 392
Miral
  • 12,637
  • 4
  • 53
  • 93
  • @TLama, as the questioner clearly states "`mongodb` as a service as a prerequisite", it is obvious that detecting the presence of the service is enough and he/she is already aware of that. The question scope is just "how to install mongodb as service in Inno Setup". – Lex Li Oct 11 '12 at 08:25