Nullsoft Scriptable Install System (NSIS) 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.
git clone https://github.com/rc-chuah/NSISDependencyInstaller
. !insertmacro Dependency_AddVC2013 ; Installed In Example Setup
;!insertmacro Dependency_AddVC2013 ; Commented Out And Not Installed In Example Setup
You Can Also Just Include CodeDependencies.nsh File Into Your Setup And Call The Desired Dependency_Add Macros (Some May Need Defining Their Exe File Path Before The Include):
!include "CodeDependencies.nsh"
; Define ...
Function .onInit
; Add The Dependencies You Need
!insertmacro Dependency_AddDotNet90
; ...
FunctionEnd
; Section ...
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:
File "dxwebsetup.exe"
Call ExtractTemporaryFile Macro Before The Corresponding Dependency_Add Macros
!insertmacro 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:
!insertmacro Dependency_ForceX86 True ; Force 32-Bit Install Of Next Dependencies
!insertmacro Dependency_AddVC2013
!insertmacro 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 [${If} ${IsNativeARM64} ${ElseIf} ${RunningX64} ${Else} ${EndIf}], [${If} ${IsNativeARM64} ${ElseIf} ${IsNativeAMD64} ${ElseIf} ${IsNativeIA32} ${Else} Abort “Unsupported CPU Architecture!” ${EndIf}], [${If} ${RunningX64} ${Else} ${EndIf}], [SetRegView 64], [SetRegView 32], [${DisableX64FSRedirection}], [${EnableX64FSRedirection}] And [${IsWow64}] In [MainSection], [-AdditionalIcons], [-Post] And [Uninstall] Sections.
Thanks To The Community For Sharing Many Fixes And Improvements. To Contribute Please Create A Pull Request.