Click here to Skip to main content
15,888,527 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

 
GeneralRe: WizardSmallImageFile Pin
Pascal Hubert1-Sep-10 9:27
Pascal Hubert1-Sep-10 9:27 
GeneralRe: WizardSmallImageFile Pin
sakethrao24-Sep-10 2:05
sakethrao24-Sep-10 2:05 
GeneralNew .NET Framework 4 (Full + Client) script here! [modified] Pin
Anthony Daly4-Jul-10 6:34
Anthony Daly4-Jul-10 6:34 
GeneralUpdated MSI 4.5 for 32 and 64-bit Pin
jtitley24-Jun-10 21:12
jtitley24-Jun-10 21:12 
GeneralSome Enhancements Pin
jtitley24-Jun-10 21:09
jtitley24-Jun-10 21:09 
QuestionRe: Some Enhancements [modified] Pin
daveaton20-Nov-10 13:44
daveaton20-Nov-10 13:44 
GeneralRe: Some Enhancements Pin
Rei Masi23-Feb-11 1:45
Rei Masi23-Feb-11 1:45 
GeneralSome new packages: SQL 2008 R2 Express, SQL 3.5 Compact, MSI 4.5 [modified]♦ Pin
Hovedsjef11-Jun-10 2:46
Hovedsjef11-Jun-10 2:46 
Thanks for an excellent adaption of the Inno setup.
I just thought I'd submit back a couple of new scripts that I made to suit additional prerequisites I had for a setup package I created:

- Windows Installer 4.5
- SQL 3.5 Compact Edition for Desktops
- SQL 2008 R2 Express

Windows Installer 4.5 (msi45.iss)
[CustomMessages]
msi45win60_title=Windows Installer 4.5 for Windows Vista & Windows 7
msi45win52_title=Windows Installer 4.5 for Server 2003
msi45win51_title=Windows Installer 4.5 for Windows XP

msi45win60_size=1.7 MB
msi45win52_size=3.0 MB
msi45win51_size=3.2 MB



[Code]
const
	msi45win60_url = 'http://download.microsoft.com/download/2/6/1/261fca42-22c0-4f91-9451-0e0f2e08356d/Windows6.0-KB942288-v2-x86.msu';
  msi45win52_url = 'http://download.microsoft.com/download/2/6/1/261fca42-22c0-4f91-9451-0e0f2e08356d/WindowsServer2003-KB942288-v4-x86.exe';
  msi45win51_url = 'http://download.microsoft.com/download/2/6/1/261fca42-22c0-4f91-9451-0e0f2e08356d/WindowsXP-KB942288-v3-x86.exe';
procedure msi45(MinVersion: string);
begin
	// Check for required Windows Installer 3.0 on Windows 2000 or higher
	if minwinversion(6, 0) and (fileversion(ExpandConstant('{sys}{\}msi.dll')) < MinVersion) then
		AddProduct('msi45win60.msu',
			'/quiet /norestart',
			CustomMessage('msi45win60_title'),
			CustomMessage('msi45win60_size'),
			msi45win60_url)
	else if minwinversion(5, 2) and (fileversion(ExpandConstant('{sys}{\}msi.dll')) < MinVersion) then
		AddProduct('msi45win52.exe',
			'/quiet /norestart',
			CustomMessage('msi45win52_title'),
			CustomMessage('msi45win52_size'),
			msi45win52_url)
	else if minwinversion(5, 1) and (fileversion(ExpandConstant('{sys}{\}msi.dll')) < MinVersion) then
		AddProduct('msi45win51.exe',
			'/quiet /norestart',
			CustomMessage('msi45win51_title'),
			CustomMessage('msi45win51_size'),
			msi45win51_url);
end;

To make the MSU package work (under Vista/Win7), I used the tip from sascha_kib in his posting install .msi packages of Mar 17 2010 (thanks, mate!)

SQL 3.5 Compact Edition for Desktops (ssceruntime.iss)
[CustomMessages]
ssceruntime_title=SQL Server Compact 3.5 Service Pack 2 for Windows Destkop
ssceruntime_unpack=SQL Server Compact 3.5 Service Pack 2 for Windows Destkop (uncompress package)

ssceruntime_size=5.3 MB


[Code]
const
	ssceruntime_url = 'http://download.microsoft.com/download/E/C/1/EC1B2340-67A0-4B87-85F0-74D987A27160/SSCERuntime-ENU.exe';

procedure ssceruntime();
var
	version: cardinal;
begin
	if not RegKeyExists(HKLM, 'SOFTWARE\Microsoft\Microsoft SQL Server Compact Edition\v3.5') then
   	AddProduct('ssceruntime.msi',
	  	'/qb',
	    CustomMessage('ssceruntime_title'),
      CustomMessage('ssceruntime_size'),
	    ssceruntime_url);
end;


SQL 2008 R2 Express (sql2008express.iss):
[CustomMessages]
sql2008express_title=SQL Server 2008 R2 Express

en.sql2008express_size=59 MB
de.sql2008express_size=59 MB


[Code]
const
	sql2008express_url = 'http://download.microsoft.com/download/5/1/A/51A153F6-6B08-4F94-A7B2-BA1AD482BC75/SQLEXPR32_x86_ENU.exe';

procedure sql2008express();
var
	version: string;
begin
	// This check does not take into account that a full version of SQL Server could be installed,
	// making Express unnecessary.
	RegQueryStringValue(HKLM, 'SOFTWARE\Microsoft\Microsoft SQL Server\SQLEXPRESS\MSSQLServer\CurrentVersion', 'CurrentVersion', version);
	if version < '10.5' then
		AddProduct('sql2008express.exe',
			'/QS  /IACCEPTSQLSERVERLICENSETERMS /ACTION=Install /FEATURES=SQL /INSTANCENAME=SQLEXPRESS /SQLSVCACCOUNT="NT AUTHORITY\Network Service" /SQLSYSADMINACCOUNTS="builtin\administrators"',
			CustomMessage('sql2008express_title'),
			CustomMessage('sql2008express_size'),
			sql2008express_url);
end;


Of course, to make these work, put the files together with the others in the scripts\products folder. Then add the appropriate include statements to setup.iss and also the function calls like

#include "scripts\products\sql2008express.iss"

and

sql2008express().

You should make sure to put these installations after .NET-installations and then the MSI packages before the SQL packages.

Hope this may be of any interest/help to someone out there.
Hovedsjef
(means "Main boss" in norwegian) Cool | :cool:
http://nerdynotes.blogspot.com
modified on Friday, June 11, 2010 10:03 AM

GeneralRe: Some new packages: SQL 2008 R2 Express, SQL 3.5 Compact, MSI 4.5 [modified]♦ Pin
Ramsdal4220-Jul-10 4:04
Ramsdal4220-Jul-10 4:04 
GeneralRe: Some new packages: SQL 2008 R2 Express, SQL 3.5 Compact, MSI 4.5 [modified]♦ Pin
Hovedsjef20-Jul-10 11:18
Hovedsjef20-Jul-10 11:18 
GeneralRe: Some new packages: SQL 2008 R2 Express, SQL 3.5 Compact, MSI 4.5 [modified]♦ Pin
Mezofi14-Sep-10 3:28
Mezofi14-Sep-10 3:28 
GeneralRe: Some new packages: SQL 2008 R2 Express, SQL 3.5 Compact, MSI 4.5 [modified]♦ Pin
Nick Olsen16-Nov-10 8:04
Nick Olsen16-Nov-10 8:04 
GeneralRe: Some new packages: SQL 2008 R2 Express, SQL 3.5 Compact, MSI 4.5 [modified]♦ Pin
Rei Masi23-Feb-11 0:47
Rei Masi23-Feb-11 0:47 
GeneralRe: Some new packages: SQL 2008 R2 Express, SQL 3.5 Compact, MSI 4.5 [modified]♦ Pin
Nick Olsen23-Feb-11 2:38
Nick Olsen23-Feb-11 2:38 
GeneralRe: Some new packages: SQL 2008 R2 Express, SQL 3.5 Compact, MSI 4.5 [modified]♦ Pin
Rei Masi23-Feb-11 3:05
Rei Masi23-Feb-11 3:05 
GeneralRe: Some new packages: SQL 2008 R2 Express, SQL 3.5 Compact, MSI 4.5 [modified]♦ Pin
HEMICRO21-May-11 6:46
HEMICRO21-May-11 6:46 
QuestionCompile Error in products.iss line 114 Pin
Claudio Barca5-Jun-10 8:19
Claudio Barca5-Jun-10 8:19 
AnswerRe: Compile Error in products.iss line 114 Pin
runeb14-Jun-10 11:51
runeb14-Jun-10 11:51 
AnswerRe: Compile Error in products.iss line 114 Pin
NoiadoX23-Nov-10 7:31
NoiadoX23-Nov-10 7:31 
QuestionHelp. Minimal Script for my application Pin
Daniel0198324-May-10 7:12
Daniel0198324-May-10 7:12 
Question.NET Framework 4.0 Client Profile Compatibility Pin
jonnys212330-Apr-10 17:43
jonnys212330-Apr-10 17:43 
AnswerRe: .NET Framework 4.0 Client Profile Compatibility Pin
Aussie ALF4-May-10 2:02
Aussie ALF4-May-10 2:02 
GeneralRe: .NET Framework 4.0 Client Profile Compatibility [modified] Pin
Anthony Daly4-Jul-10 6:30
Anthony Daly4-Jul-10 6:30 
GeneralProblems installing Windows Installer 3.1 Pin
_FORCER_11-Apr-10 2:02
_FORCER_11-Apr-10 2:02 
Generalinstall .msi packages Pin
sascha_kib17-Mar-10 11:47
sascha_kib17-Mar-10 11:47 

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.