installing system component if not existing before install

49 views
Skip to first unread message

Bernard Laurent

unread,
Aug 22, 2024, 5:25:17 AM8/22/24
to innosetup
Hello,

I would like to install Microsoft Access Runtime, before installing my application, if it's not already installed.
I saw that I can use a beforeinstall parameter in [Files] section, but I don't know how to do that, as if have not for example to manage DestDir: ...
Should these below lines be correct ?

[Files] Source: "MicrosoftAccessRuntime.exe"; BeforeInstall: MyBeforeInstall

[Code] procedure MyBeforeInstall(); begin MsgBox('About to install Microsoft Access Runtime as ' + CurrentFileName + '.', mbInformation, MB_OK); end; 

Thanks for your help !

Bernard

Gavin Lambert

unread,
Aug 22, 2024, 8:46:16 PM8/22/24
to innosetup
On Thursday, August 22, 2024 at 9:25:17 PM UTC+12 Bernard Laurent wrote:
I would like to install Microsoft Access Runtime, before installing my application, if it's not already installed.
I saw that I can use a beforeinstall parameter in [Files] section, but I don't know how to do that, as if have not for example to manage DestDir: ...

No, that's not the right way to do that sort of thing.

You can install the [Files] to {tmp} and then use an AfterInstall to actually Exec the installer, but this is not recommended practice either.

The recommended way to handle installation of prerequisites is to write [Code] in PrepareToInstall.  See the CodePrepareToInstall example included with Inno for some of the basic structure -- the extra piece is that for the actual installation you will need to use ExtractTemporaryFile and Exec (and interpret exit codes appropriately).  If this is the only use of the file, you can also mark it with Flags: dontcopy.

Andrew Truckle

unread,
Aug 31, 2024, 2:18:10 AM8/31/24
to innosetup
See Inno Dependency Installer:


It is simple to use, and works very well.
Reply all
Reply to author
Forward
0 new messages