Click here to Skip to main content
15,116,277 members
Articles / .NET / .NET5

Tagged as

Stats

1.4M views
23.9K downloads
393 bookmarked

Inno Setup Dependency Installer

Rate me:
Please Sign up or sign in to vote.
4.89/5 (171 votes)
28 Sep 2021CPOL2 min read
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 the Github repository.
  3. Open the extracted CodeDependencies.iss file.
  4. Comment out dependency defines to disable installing them in the example setup and leave only dependencies that need to be installed:
    • Pascal
      #define UseVC2013 <-- installed in example setup
    • Pascal
      ;#define UseVC2013 <-- commented out and not installed in example setup
  5. Modify other sections like [Setup] [Files] [Icons] as necessary.
  6. Build setup using Inno Setup compiler.

Integration

You can include CodeDependencies.iss file into your setup, disable compilation of the example setup, forward the required Inno Setup functions to the shared dependency code, and call the dependency install functions as needed:

Pascal
#define Dependency_NoExampleSetup
#include "CodeDependencies.iss"

[Setup]
; ...

[Code]
procedure InitializeWizard;
begin
  Dependency_InitializeWizard;
end;

function PrepareToInstall(var NeedsRestart: Boolean): String;
begin
  Result := Dependency_PrepareToInstall(NeedsRestart);
end;

function NeedRestart: Boolean;
begin
  Result := Dependency_NeedRestart;
end;

function UpdateReadyMemo(const Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo, MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;
begin
  Result := Dependency_UpdateReadyMemo(Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo, MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo);
end;

function InitializeSetup: Boolean;
begin
  // add the dependencies you need
  Dependency_AddVC2013;
  // ...

  Result := True;
end;

Details

You have two ways to distribute the dependency installers. By default, the dependency will be downloaded from the official website once it is defined as required in the CodeDependencies.iss file. 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 installation routine of the dependencies is automatic, and in quiet or semi quiet mode. Therefore, no user interaction is needed.

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
    • .NET Core Runtime 3.1
    • ASP.NET Core Runtime 3.1
    • .NET Desktop Runtime 3.1
    • .NET Runtime 5.0
    • ASP.NET Core Runtime 5.0
    • .NET Desktop Runtime 5.0
  • 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-2019 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 2 Express
    • SQL Server 2017 Express
    • SQL Server 2019 Express
  • DirectX End-User 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)

Share

About the Author

DomGries
Unknown
No Biography provided

Comments and Discussions

 
QuestionWin 2008 R2 installation using the role manager Pin
torno22-Jan-13 5:47
Membertorno22-Jan-13 5:47 
AnswerRe: Win 2008 R2 installation using the role manager Pin
torno24-Jan-13 3:13
Membertorno24-Jan-13 3:13 
GeneralRe: Win 2008 R2 installation using the role manager Pin
Harald Binkle4-Apr-13 3:49
MemberHarald Binkle4-Apr-13 3:49 
GeneralRe: Win 2008 R2 installation using the role manager Pin
Freddyvdh15-Jan-14 6:22
MemberFreddyvdh15-Jan-14 6:22 
GeneralRe: Win 2008 R2 installation using the role manager Pin
Binkle@JAM15-Jan-14 22:05
MemberBinkle@JAM15-Jan-14 22:05 
QuestionI dont know this code "OutputBaseFilename={#MyAppSetupName}-{#MyAppVersion}" Pin
Sun-Mi Kang15-Jan-13 15:12
MemberSun-Mi Kang15-Jan-13 15:12 
AnswerRe: I dont know this code "OutputBaseFilename={#MyAppSetupName}-{#MyAppVersion}" Pin
Atlence24-May-13 2:06
MemberAtlence24-May-13 2:06 
GeneralMy vote of 5 Pin
Sun-Mi Kang15-Jan-13 15:01
MemberSun-Mi Kang15-Jan-13 15:01 
Thanks your article..
I can get useful tips of Inno Setup. Great Job!(:
GeneralMy vote of 5 Pin
Felicia Santoro-Petti2-Jan-13 6:01
MemberFelicia Santoro-Petti2-Jan-13 6:01 
QuestionGoogle Chrome Installation Check Pin
kalpesh28041-Jan-13 20:14
Memberkalpesh28041-Jan-13 20:14 
QuestionJava Installation Check Pin
kalpesh28041-Jan-13 20:04
Memberkalpesh28041-Jan-13 20:04 
GeneralMy Vote Of 5+ Pin
Brisingr Aerowing18-Dec-12 18:19
professionalBrisingr Aerowing18-Dec-12 18:19 
Question.net Framework 4.5 Pin
airscape18-Dec-12 14:00
Memberairscape18-Dec-12 14:00 
SuggestionRe: .net Framework 4.5 Pin
Member 967595128-Jan-13 1:01
MemberMember 967595128-Jan-13 1:01 
GeneralMy vote 5 Pin
Dato001119-Nov-12 3:54
MemberDato001119-Nov-12 3:54 
QuestionKB835732 doesn't work in Windows 2000 setup Pin
Vinny Lawlor12-Nov-12 7:15
MemberVinny Lawlor12-Nov-12 7:15 
QuestionDirectX Installation Pin
TheRacerMaster26-Oct-12 18:47
MemberTheRacerMaster26-Oct-12 18:47 
AnswerRe: DirectX Installation Pin
daveaton9-Mar-13 17:40
Memberdaveaton9-Mar-13 17:40 
GeneralMessage Closed Pin
10-Mar-13 0:28
MemberDomGries10-Mar-13 0:28 
GeneralRe: DirectX Installation Pin
daveaton10-Mar-13 8:36
Memberdaveaton10-Mar-13 8:36 
Questiondependency file not added to output setup.exe Pin
Member 80634354-Oct-12 14:23
MemberMember 80634354-Oct-12 14:23 
AnswerRe: dependency file not added to output setup.exe Pin
Member 80634355-Oct-12 2:38
MemberMember 80634355-Oct-12 2:38 
AnswerRe: dependency file not added to output setup.exe Pin
Member 905500031-Oct-12 5:37
MemberMember 905500031-Oct-12 5:37 
GeneralMy vote of five Pin
Michael Estwik12-Aug-12 12:53
MemberMichael Estwik12-Aug-12 12:53 
SuggestionMS Compact Database Version 4.0 Pin
Freddyvdh12-Jul-12 4:44
MemberFreddyvdh12-Jul-12 4:44 

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.