fbpx

How to implement Inno Setup

Inno Setup

Inno Setup is an open-source compiler to create installers on windows. It is a free tool that provides a rich feature set.

Creating the installer using Inno Setup involves the following two steps:

👉 Create an Inno Script file
👉Compile the Script file

InnoSetup script file is a simple text file with the extension “.iss”. In this script file, the contents are arranged in sections. Each section handles a specific function of the installation:

📌 Setup: This section consists of settings and application-related information like application name, publisher name, etc.
📌Languages: List of languages supported.
📌Tasks: Tasks to be performed by the setup during the installation.
📌Files: Files to be copied to the User’s system.
📌Icons: The Application shortcuts: Start menu folders, etc. are defined here.
📌Run: Any executable to be executed after the installation is completed.

Creating installations in Visual Studio

Right-click on the solution and select to add a new Installer project (class library):

 

Add ‘Inno Setup’ contents to your Installer project. Right-click and select Add > New folder:

Download the Inno Setup package from Nugget to the Installer project:

Add the setup (*.iss) file:

 

Modify the installer *.iss file. Here we use a minimalist example of the script file for demonstration purposes:

				
					; -- installer.iss --
 
[Setup]
AppName=InnoExampleInstaller
AppVersion=1.0
DefaultDirName={pf}\InnoExample
DefaultGroupName=InnoExample
Compression=lzma2
SolidCompression=yes
OutputBaseFilename=InnoExampleInstaller
OutputDir=.
UninstallDisplayIcon={app}\InnoExample.exe
UninstallDisplayName=InnoExample
 
[Files]
Source: "..\InnoExample\bin\Debug\InnoExample.exe"; DestDir: "{app}"
 
[Icons]
Name: "{group}\InnoExampleInstaller"; Filename: "{app}\InnoExample.exe"
Name: "{group}\Uninstall"; Filename: "{uninstallexe}"
				
			

 

For information:

{pf} location of the Program Files directory

{app} application directory

{group} path to the start menu folder

You can download and install the Inno Setup Wizard to write the file from Inno Setup 🌐

For example:

 

Set post-build events in the Installer project:

				
					if $(ConfigurationName) == Release "$(SolutionDir)packages\Tools.InnoSetup.6.2.0\tools\ISCC.exe" "$(ProjectDir)installer.iss
				
			

Conclusion

Inno Setup does almost anything you expect from an installer, does it quickly, and does it well. Is a free, fast, easy-to-use installation tool that generates fast, lightweight setup executables.

When all the necessary sections are filled out, the Inno Setup script is compiled, and an executable installer file is generated in the folder that was specified in the OutputDir directive in the Setup section.

Give it a try and tell us the results! 

1664 Views
Author
Ssr Backend Developer at e-verse

Developer with more than 7 years of experience with .Net in C#. Always trying to find new challenges and solutions in my work. One of the things I like the most is working as a team and sharing knowledge with them to achieve good results.


Helpful Links: