How to make an installer

How to make an installer with NSIS

Code updated to work on Windows 10 properly.

 

Many people may have a finished product but lacking an installer for the product. There are lots of installer creating software, but some of them are very expensive. NSIS is a free installer scripting system from Nullsoft. I use it in my products. In this blog I present my example script that gets beginners started.

At first NSIS may seem complicated, but fortunately it has many macros, that make creating an installer an easy task. The picture below shows one page of the built example script presented at the end of this blog post.

NSIS-example

Now, let’s get on with NSIS.

An NSIS installer has one ore more pages. The pages are created with macros in the script (in our example).

Furthermore, every script is build up with sections. Each section except the uninstaller section is shown in the ”Choose Components” page as shown in the picture above.

In our example script we are using the modern user interface, MUI in short. First there’s defined some constants, that make life easier later in the script and make the script easily re-usable. The example script installs for all users. The line

SetShellVarContext all

means all the users. And in the registry key registration HKLM is related to all users.

Enough, let’s see the commented example script (name it as myscript.nsi or something):

Other environment variables that often are needed, when creating an installer are $APPDATA and $DOCUMENTS for the %AppData% folder and Documents folder respectively.

Links: