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!Ā 

1848 Views

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.