Let's Make an Installer!

We'll cover the following

Now that we have an executable and a bunch of dependencies, how do we make an installer? For this chapter we’ll be using Inno Setup, but you could also use NSIS or a Microsoft branded installer. You will need to go to their website (http://www.jrsoftware.org/isdl.php), download the program and install it. Then run the program. You should see the main program along with the following dialog on top of it:


Choose the Create a new script using the Script Wizard option and then press the OK button. Click Next and you should see something like this:


Fill this out however you like and click Next (I called mine wxForm). This next screen allows you to choose where you want the application to be installed by default. It defaults to Program Files which is fine. Click Next. Now you should see the following screen:


Browse to the executable you created to add it. Then click the Add file(s)… button to add the rest. You can actually select all of the files except for the exe and hit OK. This is how mine turned out:


Now you’re ready to click Next. Make sure the Start Menu folder has the right name (in this case, wxForm) and continue. You can ignore the next two screens or experiment with them if you like. I’m not using a license or putting information files in to display to the user though. The last screen before finishing allows you to choose a directory to put the output into. I just left that empty since it defaults to where the executable is located, which is fine with this example. Click Next, Next and Finish. This will generate a full-fledged .iss file, which is what Inno Setup uses to turn your application into an installer. It will ask you if you’d like to go ahead and compile the script now. Go ahead and do that. Then it will ask if you’d like to save your .iss script. That’s a good idea, so go ahead and do that too. Hopefully you didn’t receive any errors and you can try out your new installer.

If you’re interested in learning about Inno’s scripting language, feel free to read Inno’s Documentation. You can do quite a bit with it. If you happen to make changes to your build script, you can rebuild your installer by going to the build menu and choosing the compile menu item.

Wrapping Up

At this point, you now know how to create a real, live installer that you can use to install your application and any files it needs to run. This is especially handy when you have a lot of custom icons for your toolbars or a default database, config file, etc that you need to distribute with your application. Go back and try creating the installer again, but choose different options to see what else you can do. Experimenting is a great way to learn. Just make sure you always have a backup in case something goes wrong!

Get hands-on with 1200+ tech skills courses.