fbpx

Inno Setup: The Comprehensive Guide to Creating Windows Installers

Open source compiler Inno setup windows installers

Introduction

Inno Setup is an open-source compiler that simplifies the creation of installers for Windows applications. This powerful and free tool boasts a rich feature set, making it a popular choice for developers looking to package their software efficiently and effectively.

Key Steps to Create an Installer Using Inno Setup

Creating an installer with Inno Setup involves two primary steps:

  1. Create an Inno Script File
  2. Compile the Script File

Understanding the Inno Script File

The Inno Script file, a simple text file with the .iss extension, organizes its contents into several sections, each dedicated to specific functions of the installation process:

  • Setup: Contains settings and application-related information such as the application name, publisher name, and more.
  • Languages: Lists the languages supported by the installer.
  • Tasks: Specifies tasks that the setup should perform during the installation process.
  • Files: Details the files that need to be copied to the user’s system.
  • Icons: Defines application shortcuts, including those for the Start menu folders.
  • Run: Lists any executables to be run after the installation is completed.

Creating Installations in Visual Studio

To integrate Inno Setup with Visual Studio, follow these steps:

  1. Add a New Installer Project:
    • Right-click on the solution in Visual Studio and select “Add” -> “New Project” -> “Installer Project (Class Library)”.

Inno setup visual studio installer project
  1.  Add Inno Setup Contents:
    • Right-click on the installer project, select “Add” -> “New Folder” to organize the contents.

Addition of inno setup contents

 2.   Download Inno Setup Package:

    • Install the Inno Setup package from NuGet into the installer project.

Installing inno setup package

3.   Add and Modify the Script File:

    • Add the setup script (*.iss file) to your project and customize it according to your application’s requirements.

nno setup wizard

Sample Inno Setup Script

Here is a minimalist example of an Inno Setup script file to illustrate the process:

				
					; -- 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}"
				
			

Key Directives Explained:

  • {pf}: Location of the Program Files directory.
  • {app}: Application directory.
  • {group}: Path to the Start menu folder.

Using the Inno Setup Wizard

To write and edit the script file, you can download and install the Inno Setup Wizard from the Inno Setup website. The wizard provides a user-friendly interface for configuring and generating the script file.

Inno setup wizard

Setting Post-Build Events

To automate the build process, set post-build events in the installer project as follows:

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


Conclusion

Inno Setup is a robust, fast, and easy-to-use tool for creating Windows installers. It handles almost any installation requirement efficiently, generating lightweight and reliable setup executables. With the essential sections filled out, the Inno Setup script can be compiled to produce an executable installer file, which is then ready for distribution.

Give Inno Setup a try for your next project and share your experiences with us!

2423 Views


Helpful Links: