Click here to Skip to main content
15,886,724 members
Articles / Programming Languages / SQL

Inno Setup Dependency Installer

Rate me:
Please Sign up or sign in to vote.
4.91/5 (191 votes)
7 Aug 2023CPOL2 min read 1.7M   24.9K   427   392
Download and install any dependency such as .NET, Visual C++ or SQL Server during your application's installation!
In this article, you will see installation, usage, integration, details, and dependencies of Inno Setup Dependency Installer.

Inno Setup Dependency Installer

Introduction

Inno Setup Dependency Installer can download and install any dependency such as .NET, Visual C++ or SQL Server during your application's installation. In addition, it is easy to add your own dependencies as well.

Installation and Usage

  1. Download and install Inno Setup 6.2+.
  2. Download the script from here or from the Github repository.
  3. Open the extracted ExampleSetup.iss file.
  4. Comment out dependency function calls inside InitializeSetup function to disable installing them:
    • Pascal
      Dependency_AddVC2013;   // installed in example setup
      //Dependency_AddVC2013; // commented out and not installed in example setup
  5. Modify other sections like [Setup] [Files] [Icons] as necessary.
  6. Build the setup using Inno Setup compiler.

Integration

You can also just include CodeDependencies.iss file into your setup and call the desired Dependency_Add functions (some may need defining their exe file path before the include):

Pascal
#define public Dependency_Path_NetCoreCheck "dependencies\"

#include "CodeDependencies.iss"

[Setup]
; ...

[Code]
function InitializeSetup: Boolean;
begin
  // add the dependencies you need
  Dependency_AddDotNet70;
  // ...

  Result := True;
end;

Details

You have two ways to distribute the dependency installers. By default, most dependencies will be downloaded from the official website. Another way is to pack the dependency into a single executable setup like so:

  • Include the dependency setup file by defining the source:

    Pascal
    Source: "dxwebsetup.exe"; Flags: dontcopy noencryption
  • Call ExtractTemporaryFile() before the corresponding Dependency_Add function:

    Pascal
    ExtractTemporaryFile('dxwebsetup.exe');

The dependencies are installed based on the system architecture. If you want to install 32-bit dependencies on a 64-bit system, you can force 32-bit mode like so:

Pascal
Dependency_ForceX86 := True;  // force 32-bit install of next dependencies
Dependency_AddVC2013;
Dependency_ForceX86 := False; // disable forced 32-bit install again

If you only deploy 32-bit binaries and dependencies, you can also instead just not define ArchitecturesInstallIn64BitMode in [Setup].

Dependencies

  • .NET
    • .NET Framework 3.5 Service Pack 1
    • .NET Framework 4.0
    • .NET Framework 4.5.2
    • .NET Framework 4.6.2
    • .NET Framework 4.7.2
    • .NET Framework 4.8.1
    • .NET Core 3.1 (Runtime, ASP.NET, Desktop)
    • .NET 5.0 (Runtime, ASP.NET, Desktop)
    • .NET 6.0 (Runtime, ASP.NET, Desktop)
    • .NET 7.0 (Runtime, ASP.NET, Desktop)
  • C++
    • Visual C++ 2005 Service Pack 1 Redistributable
    • Visual C++ 2008 Service Pack 1 Redistributable
    • Visual C++ 2010 Service Pack 1 Redistributable
    • Visual C++ 2012 Update 4 Redistributable
    • Visual C++ 2013 Update 5 Redistributable
    • Visual C++ 2015-2022 Redistributable
  • SQL
    • SQL Server 2008 R2 Service Pack 2 Express
    • SQL Server 2012 Service Pack 4 Express
    • SQL Server 2014 Service Pack 3 Express
    • SQL Server 2016 Service Pack 3 Express
    • SQL Server 2017 Express
    • SQL Server 2019 Express
    • SQL Server 2022 Express
  • Access
    • Access Database Engine 2010
    • Access Database Engine 2016
  • DirectX End-User Runtime
  • WebView2 Runtime

Credits

Thanks to the community for sharing many fixes and improvements. To contribute, please create a pull request.

This article was originally posted at https://github.com/DomGries/InnoDependencyInstaller

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Unknown
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralContribution of additional scripts Pin
Phil Jollans26-Jul-09 3:24
Phil Jollans26-Jul-09 3:24 
GeneralMessage Closed Pin
3-Sep-09 7:14
DomGries3-Sep-09 7:14 
GeneralRe: Contribution of additional scripts Pin
Phil Jollans3-Oct-09 7:59
Phil Jollans3-Oct-09 7:59 
GeneralRe: Contribution of additional scripts Pin
Masurium23-Jun-10 10:38
Masurium23-Jun-10 10:38 
GeneralRe: Contribution of additional scripts Pin
Member 39986793-Mar-11 0:04
Member 39986793-Mar-11 0:04 
GeneralRe: Contribution of additional scripts Pin
Phil Jollans3-Mar-11 9:10
Phil Jollans3-Mar-11 9:10 
GeneralRe: Contribution of additional scripts Pin
HEMICRO25-May-11 9:21
HEMICRO25-May-11 9:21 
GeneralRe: Contribution of additional scripts Pin
Phil Jollans3-Mar-11 9:20
Phil Jollans3-Mar-11 9:20 
I have made a change to the script SqlCompact35.iss.

In this script I have abandoned using the function MsiQueryProductState to check for an installed product ID. I found that there were too many variations of this product with different UUIDs.

This is the version which I am now using:

// Microsoft SQL Server Compact 3.5 SP1

[CustomMessages]
SqlCompact35_title=Microsoft SQL Server Compact 3.5 SP1

en.SqlCompact35_size=2.3 MB
de.SqlCompact35_size=2,3 MB
fr.SqlCompact35_size=2,3 Mo

[Run]
Filename: {tmp}\SSCERuntime-ENU-x86.msi; Parameters: /qn; Description: {cm:SqlCompact35_title}; StatusMsg: {cm:depinstall_status,{cm:SqlCompact35_title}}; Flags: skipifdoesntexist shellexec waituntilterminated

[Code]
const
	SqlCompact35_url    = 'http://download.microsoft.com/download/8/4/2/8423c019-ccb4-4d7d-b7f0-bcf83f1b9218/SSCERuntime-ENU-x86.msi';

procedure SqlCompact35();
var
	installstate: Boolean ;
begin
	installstate := RegValueExists ( HKLM, 'SOFTWARE\Microsoft\Microsoft SQL Server Compact Edition\v3.5', 'Version' ) ;

	if Not installstate then
		InstallPackage('SqlCompact35', 'SSCERuntime-ENU-x86.msi', CustomMessage('SqlCompact35_title'), CustomMessage('SqlCompact35_size'), SqlCompact35_url);
end;


As already noted in another post, I am using an older version of the code from this article. To work with the current version, I believe that you will have to replace InstallPackage with AddProduct.

Phil
GeneralNew version Pin
Donsw14-Jun-09 17:01
Donsw14-Jun-09 17:01 
GeneralRequire Restart Pin
Nick Olsen8-Jun-09 13:44
Nick Olsen8-Jun-09 13:44 
GeneralRe: Require Restart Pin
Member 649271319-Aug-09 2:59
Member 649271319-Aug-09 2:59 
GeneralMicrosoft Download URL Pin
Steve Legendre28-May-09 8:21
Steve Legendre28-May-09 8:21 
QuestionRestart Pin
lizzle2shizzle25-May-09 22:00
lizzle2shizzle25-May-09 22:00 
AnswerRe: Restart Pin
Nick Olsen8-Jun-09 13:45
Nick Olsen8-Jun-09 13:45 
GeneralRunning Downloaded/Supplied Files not in quite mode Pin
Nick Olsen12-May-09 14:21
Nick Olsen12-May-09 14:21 
GeneralMessage Closed Pin
13-May-09 5:19
DomGries13-May-09 5:19 
GeneralRe: Running Downloaded/Supplied Files not in quite mode Pin
Nick Olsen13-May-09 6:28
Nick Olsen13-May-09 6:28 
GeneralMessage Closed Pin
14-May-09 5:56
DomGries14-May-09 5:56 
GeneralRe: Running Downloaded/Supplied Files not in quite mode Pin
Nick Olsen15-May-09 6:14
Nick Olsen15-May-09 6:14 
GeneralRe: Running Downloaded/Supplied Files not in quite mode Pin
Jazar35721-May-09 8:34
Jazar35721-May-09 8:34 
GeneralMessage Closed Pin
22-May-09 2:31
DomGries22-May-09 2:31 
GeneralRe: Running Downloaded/Supplied Files not in quite mode Pin
Nick Olsen8-Jun-09 13:38
Nick Olsen8-Jun-09 13:38 
Questionwhere is check for already installed is done? Pin
Priyank Bolia31-Mar-09 7:16
Priyank Bolia31-Mar-09 7:16 
AnswerMessage Closed Pin
1-Apr-09 6:29
DomGries1-Apr-09 6:29 
GeneralRe: where is check for already installed is done? Pin
Priyank Bolia1-Apr-09 7:39
Priyank Bolia1-Apr-09 7:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.