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.
- Download and install Inno Setup 6.2+.
- Download this repository or clone it.
- Open the extracted CodeDependencies.iss file.
- Comment out dependency defines to disable installing them in the example setup and leave only dependencies that need to be installed:
#define UseVC2013 <-- installed in example setup ;#define UseVC2013 <-- commented out and not installed in example setup
- Modify other sections like [Setup] [Files] [Icons] as necessary.
- Build setup using Inno Setup compiler.
You can include CodeDependencies.iss file into your setup by disabling compilation of the example setup before, forwarding the required Inno Setup functions to the shared dependency code, and calling the dependency install functions as needed:
#define public 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;
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:
Source: "dxwebsetup.exe"; Flags: dontcopy noencryption
-
Call ExtractTemporaryFile() before the corresponding Dependency_Add function
ExtractTemporaryFile('dxwebsetup.exe');
The installation routine of the dependencies is automatic, and in quiet or semi quiet mode. Therefore no user interaction is needed.
-
.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
Thanks to the community for sharing many fixes and improvements. To contribute please create a pull request.