This is a research project about Installers in Windows. A guide for the folders can be found in the "docs" folder. For more information please check out all the information give in the web page and the GitHub repository. (DISCLAIMER! This information is relevant as of may 2020)
View the Project on GitHub Needlesslord/Research-Project-Installer
This web page and the GitHub repository where it is created from are dedicated to what an Installer is and how to create one for your software in Windows using xml integration and NSIS Installer extension to work wih, with small steps and a solution provided. For further information, a bibliography is provided below.
Pro tip! If you do not understand a term or need further help with this documentation, please use IT Dictionary pages such as Computer Hope or Stack Overflow or contact me directly at needlesslord@gmail.com.
A guide for the folders can be found in the “docs” folder.
DISCLAIMER! This information is relevant as of may 2020
I am Núria Lamonja i Pujol (GitHub username Needlesslord, e-mail needlesslord@gmail.com), student of the Bachelor’s Degree in Video Games by UPC at CITM-TTC. This content is generated for the second year’s subject Project 2, under supervision of lecturer Ramon Santamaria, tech developer and lead of raylib technologies and emegeme.
An Installer, Installation Package or Application Packaging is used to install software programs on a system. They simplify the process of installing software by providing the user with a step-by-step process with options to select from which will best suit individual needs. The installation process for software depends on your OS (operation system) and the program you are installing.
You may have seen them as executable (they can come in different formats, usually depending on the device) files you open to install games, different softwares and others, with detailed instructions that you usually skip with the “Next” button. This executable (sotfware which is a file used by a service) is created to install an application onto an specified device contain the files, registry and logic. They involve the preparation of standard, structured software installations targeted for automated deployment and should be prepared for both commercial software and home-made apps.
They usually contain more than only the .exe (executable file). For example, they often contain multiple files in different locations, shortcuts, registry, runtime engines, .NET registration, shell integration, ActiveX controls, databases, and more! As said before, they can also come in different formats, such as Setup.MSI (Microsoft Windows Installer); Setup.exe (Legacy executables); .APPX (Windows store, introduced with Windows 8); Install.vbs, Install.ps1 or Install. bat (Batch or script files), Loose/Raw Files or .dll, .xla, .xlam, .ppam, .dotm, etc. (add-ins or plug-ins), and more!
Installers can be used to install games on end-user machines. They usually offer full support for a customized user interface, as well as patching.
Application management costs can be a problem for many corporate networks due to the expense of the maintenance of desktop and notebook systems. Therefore, new application management techniques are being developed to help enterprises administer their existing PC investments more efficiently. One of them is application packaging, which helps business manage growing volumes of software for desktop and server systems. Therefore, Installers are used to avoid them.
First of all, you have to make sure your computer meets the system/software requirements of the program you are attempting to install, it being a game, utility, etc. It is a listing of what software programs or hardware devices are required to operate the program properly and can be found on their packaging or can be found on the Internet. If your computer does not meet the minimum requirements, it will probably not run or not even install. Also, if your computer only meets the minimum requirements but not the suggested requirements, it will run, but very slowly. Pro tip! If you do not understand a term used in the requirements (they can be very technical and most people may not be familiar with many IT lingo), the easiest way to understand the meaning behind it is to perform a search on the word. Computer Hope or Stack Overflow is a very complete web where all these terms and information can be easily found.
Secondly, you should check the manual or readme file, which contains the exact instructions on how to install your program and are usually found in the same directory (a directory could be compared to a folder, for those who are not familiar with the term) as the installation files. For those of you who may not be familiar with what a “readme file” is, it is a file with the extensions .txt or .md that contains information for the user about the software, such as instructions, additional help and details about patches and updates. Sometimes, the information it contains may not be included in the full documentation, so it is good to check out both. I the readme is not in a .txt file extension, your computer may not know how to open it. You cna choose the Notepad (advised) or any text editor of choice to open the file, since it will only contain text.
Pro tip! Finally, when installing any new program, it is advised to first close or disable any running programs and, after installing it, if it prompts you to reboot the computer, do so.
After all of this, application packages may be a very generic concept to you or you don’t fully know why you should use it. Of course, Installers were first created to solve arising problems, and in this section I will talk about the concrete purposes and benefits sought.
First of all, only the simplest applications can work with a simple file copy, and even then you need to have a convenient way to actually download and do the copying of the files to the right location.
The setup is also a marketing tool: it can be used for branding and consistency across products. Also, it allows the installation of trial versions of the product.
A setup provides upgrade and patching features for newer versions, as well as uninstall and cleanup for the software when the user wants the remove it from the computer.
Digital certificates can be used to sign, to ensure that the file cannot be hampered with in transit or that the vendor is certificable and hence, serious.
Finally, it can prevent piracy, with a solid setup and deployment.
First of all, we need to understand what Automated Builds are. In a short and easy way, it is the process of automating the creation of a software build and the associated processes. This means that, with no human interaction, the code will create releases of our software, like different “launches”, mainly to have a contingency plan. Imagine you are working on your code, but you made a mistake and it doesn’t work anymore; you could go back to a previous version, created automatically, in order to continue working. There are many programs which can do that for you.
Automated build can be divided in two main parts: deployment and continuous iteration. However, we are just going to talk about deployment in this research.
Diving into deployment, it is a very simple concept: it is all of the activities that make a software system available for use. The general deployment process consists of several interrelated activities with possible transitions between them. Something to take into account is that, since it involves both the producer and the consumer, it has to be customized according to specific requirements or characteristics.
In short, software deployment includes all the process required for preparing a software application to run and operate in a specific environment. It can bring many advantages, such as it being time saving, enhancing security, enabling to monitoring of user actions, effectiveness in software updates, and more. For more about its advantages, check out the following link.
The following part is particular to MSI Tools, which will be introduced below.
The tasks and features included in a setup are very different and they can range from very basic, such as third party tool support, to highly customized tasks. MSI has “custom actions”, where you can actually code yourself to deal with unique deployment requirements. In this section, however, I’m only going to be talking about the first one, since custom actions can be used to improve and go beyond in your Installer.
The set up basics are fundamental to your Installation Package. All third party tools provide good support for there setup fundamentals, but there are some differences. The installation of prerequisites may be the area where third party tools and free frameworks different the most in terms of ease of use. However, there are some fundamentals that all setups must have built-in.
They must check if the system is suitable for installation (your computer meets the system/software requirements)
They must scan for presence and, if necessary, install prerequisites and runtimes
They must provide a competent GUI, which must be suitable for the input of required settings from the user
They must allow installation in silent mode (for corporate use, mostly)
As said before, deployment is a simple concept, but it has some things we must take into account, since it can cause errors in the long run. Therefore, I will introduce the most common and important problems that can be generated by the deployment of software applications.
Errors are cumulative. Errors in deployment are cumulative, since once you have deployed an error, you generally have no access to the machine in question to debug, which could do more damage in the long run. A delivery process is being managed, not just debugging and binaries.
A disciplined approach is needed. Deployment (setups) is the complex process of migrating any computer from one stable state to another; in other words, change the files directory from one computer to another. This requires a disciplined approach. The setup should install all the required files and settings and ensure the product, the software we are creating the installer for, is configured for a first launch to ready to be configured upon launch. This means we need to have a software which won’t crash.
Setup requirements are always changing and growing. In addition to technical problems that we may have, we have the list of things a setup may need to do, which with upgrades, changes and advancements in technology, has to also be updated and is continuously growing. New versions of Windows (in this particular case, which could be generalized) seem to bring new obstacles to make deployment harer.
Then, even if it can create problems for our source code and the list of requirements is always growing, is it worth? The answer, of course, is yes. It is actually key for Installation Packages, since it can allow for example, unattended setup, meaning that, taking into account that some installs are tougher than others, it can help you distribute such packages to your computer by recording the changes in your system after it is installed and then these changes are deployed to other computers on your network automatically, so you don’t have to do it. To summarize, it only make the life of developers easier, since it simplifies your work, automates the code and the releases and it can prevent errors in the code.
For more information about Deployment, please take a look at the research my colleague Daniel Ruiz did on Automated Builds or Pol Galan did as well on the same topic Automated Builds CI/CD.
Installation Packages are used broadly, as said before. From programs to games to other type of software. However, in this section, I will show you where you may have seen it in games and how they made your life easier. Mostly, since users are familiar with this way of installing games and also make it really simple, fast and easy all (or almost all) games use Installers.
Disclaimer! Please note that these pictures are from different years, so the design or usage may be different now.
For example, in Game shops, when you want to use the app instead of the web, you are asked to install them to your computer through an Installation Package. Epic Games and Steam are used as examples below.
Here you can see two different pictures of the Epic Games Launcher Setup, which in this case, since it was in a Windows OS uses MSI. In both of them they are asking for a “Destination Folder” or “directory”. This means they installer is asking for a folder where you want to save all the files needed to run the game and possible future downloads.
Here you can see how the Epic Games Launcher Setup is installing all the needed files in your computer.
Here you can see how to uninstall a game directly from the Epic Games Store, step by step.
The following picture is from Steam’s Installer. It shows the License agreement, which you have to accept in order to press “Next”.
The following two pictures are from installing a game from Steam on a Mac OS (Apple). The first one shows how the end-user can choose whether to create or not shortcuts and the second one is the message Steam displays once you have already installed your product.
In games, for example, you always see them. The following images display different installers for individual games, which are not installed from Game Shops.
Here we can see what is first shown to the user when installing LOL (League of Legends).
Of course, Mods for different games also require and almost always use installers. The following picture is for an installation of a Vehicle Mod Pack for the game GTA IV (Grand Theft Auto IV).
This research in particular will be used in an RTS game developed for the same subject, Project 2 taught at CITM-TTC (UPC). The OS (operating system) used to develop it is Windows (in particular, Windows 10 and 8), therefore, we are going to use MSI (Microsoft Windows Installer).
MSI, also known as Microsoft Software Installer or nowaadays as Windows Installer, is an installer package file format used by Windows. MSI files are used for installation, storage and removal of programs. It was developed by Microsoft and it is used for the OS of Microsoft Windows, under the Freeware License.
MSI files are database files, used by Windows Installer. They contain information about an application which is divided into features and components, and every component may hold files, registry data, shortcuts, etc. It also contains the UI that is to be used for installing, and various other data such as any prerequisites to look for, custom actions to execute, the order of the installation procedure, whether to support Administrative installations, etc. It can also contain the actual files to be installed themselves, but this isn’t always the case. MSI files are executed by an EXE file that is part of Windows, called MSIEXEC.EXE. This application reads the data in the MSI file and executes the installation.
MSI files are the current recommended way of doing installations on Windows. The alternative is writing a program that performs the installation itself.
In my particular case, I had to choose with limited options in mind. My small scope of project which is only for a research for my university’s degree with no revenue from it made me move towards free software. In addition my computer and my university’s computers run on Windows OS and I had to choose a reliable software to work on it. MSI fulfills all the requisites.
Nevertheless, these are in my particular case, to know what I was looking for. Windows Installer has many built-in functions that will save you time and effort, and here you have a list to show you why I went with it:
Automatic, install, uninstall, reinstall, repair support and add/remove components. In addition, if your software is already installed, instead of showing you the install interface it will show you the maintenance interface.
In maintenance mode, it will detect which components of an application are installed and it will allow the user to add or remove features or reinstall/uninstall the application. In addition, the repair functionality is automatically run every time a shortcut for the application is activated, which is particularly useful for administrators whose users may clean up the disk’s space carelessly.
Installer’s advertising feature. Advertising allows an application to appear to be installed, but files are not actually installed on the system until the application is activated through a shortcut, extension, or COM server. Advertising makes an application available on the desktop, but since it’s not installed until it is activated, companies save on licensing fees and disk space. Once a user clicks on a shortcut or double-clicks on a file associated with that application, the application installs automatically.
The same functionality can be written into the application itself. For example, an application may have a particular feature that is rarely used, so it is not installed by default. A developer could put Windows Installer API calls in the code that activates that feature to make it install on demand. Using installation on demand saves disk space and avoids requiring the user to exit the program and rerun the setup to install features that aren’t installed by default.
The Windows Installer service was designed to support every phase of the application management life cycle, providing a service to support each step involved in managing a desktop application from deployment through retirement.
To support these functions, the Windows Installer needs to receive instructions from an installation package.
Previously, installation packages were always setup.exe files. However, due to inconsistencies in the way independent software vendors and internal software development groups created these installation files, sometimes complications came up when administrators attempted to manage automated installations. Therefore, the emerging standard is for Windows Installer to use the msiexec.exe program to process the installation packages at an end user’s PC. The packages follow a standardized database structure containing the information that Windows Installer requires to install or uninstall an application and to run the user interface for the setup. In overall, The Windows Installer technology is divided into two parts that work in combination; these include a client-side installer service (Msiexec.exe) and a Microsoft Software Installation (MSI) package file. Windows Installer uses information contained in a package file to install the program.
.msi file: A file with .msi extension is a simple database file that can be read by Microsoft Windows Installer service contained in all recent versions of Microsoft Windows. The database contains the files, registry and instructions to the Windows Installer service in order to install the application.
Msiexec.exe: The Msiexec.exe program is a component of Windows Installer. When it is called by Setup, Msiexec.exe uses Msi.dll to read the package (.msi) files, apply any transform (.mst) files, and incorporate command-line options supplied by Setup. The installer performs all installation-related tasks, including copying files to the hard disk, making registry modifications, creating shortcuts on the desktop, and displaying dialog boxes to prompt for user installation preferences when necessary. When Windows Installer is installed on a computer, it changes the registered file type of .msi files so that if you double-click an .msi file, Msiexec.exe runs with that file.
MSI Extensions: Each installation package includes an .msi file containing the installation database, a summary information stream, and data streams for various parts of the installation. The .msi file can also contain one or more transforms, internal source files, and external source files or cabinet files required by the installation.
Note the following extensions:
Windows Installer can support many applications installed, from a network share (referred to as an administrative installation), to a locally on an end user’s PC. The downside to using a network share can be that systems receive patches or repairs only when they are connected to the network, which may be a consideration for organizations supporting many notebook users.
First of all, it is important to understand what digital signature means. Basically, a digital signature is a mathematical scheme based on algorithms to verify the authenticity of digital messages or documents. They are a standard element of the most cryptographic protocol suits and widely used for software distribution, as well as in other fields, such as financial transactions or contract management software, and it is key to detect forgery or tampering.
Signing an application package provides the user with verification that the application data has not been modified after being signed, while confirming the identity of the user or the company that signed it. Therefore, signing an Installer is an important thing since you help ensure that tampered files are not installed on end-user computers.
There are many methods and ways to approach this topic, but since we are using .msi files for the deployment of applications, I chose SignTool.exe, which is a command line tool that is used to sign an Application Package or a batch of applications with a certificate. This tool is installed in the Bin folder of the Microsoft Windows Software Development Kit installation path. Therefore, we need Microsoft Windows SDK to be able to work with SingTool.exe, which you can download here. Here you will find how to install SignTool.exe for Windows 10. Here you will find a link to learn how to install SignTool.exe for Visual Studio 2017.
The steps are easy:
Here you have a tutorial on “How to Sign an Executable File using Signtool In Windows” by GlobalSign in Youtube.
Before explaining how to test an application in a Virtual Machine, it is important to understand the concept and what it is. Basically, a Virtual Machine (VS) is an emulation of a computer system. They are based on computer architectures and provide the same functionality of a physical computer.
There are different kinds fo virtual machines, each one with different functions:
System virtual machines (VMs). They provide a substitute for the real machine, since they provide the functionalities needed to execute an entire OS, allowing as well multiple environments which are isolated from one another but co-exist in the same physical machine
Process virtual machines. They are designed to execute computer programs in a platform-independent environment.
The main purpose of VM is to test software in the safest way. Testing in VM allows to simulate a full operating system, isolated from the rest of our machine, and it’s the perfect way to test our setup installer to check whether it works or not in different OS and their previous versions.
There are several tools that you can use to create VM. In my research, however, I’m going to use VirtualBox, but bear in mind that there are many other and some may be more suitable for you project, depending on the scope, knowledge, etc.
Oracle VM VirtualBox is a free and open-source compatible with Windows, macOS, Linux, Solaris and OpenSolaris. Basically it supports the creation and management of guest virtual machines. It is aimed both for enterprises and home use. Bear in mind that VirtualBox is being actively developed with frequent releases and a growing list of features.
In the following link you can go to the official web page of VirtualBox. In the following link you can see the license (GNU General Public License (GPL)). In the following link you can see the documentation.
How to install VirutalBox
The welcome page will be first shown. Press “Next”.
Here you can choose, what install or not to install. Press “Next”.
Here you can choose how to install said features. Press “Next”.
Now you have a warning. Press “Yes”.
Here is to start installing. Press “Install”.
You will be shown a progress bar. In my case, the download was quick.
Windows may ask if you trust the software. Press “Yes”.
Before installing VirtualBox, please be sure that you install the proper platform package according to your current OS. Here you have the link to the download page of VirtualBox.
And you are done!
Obviously, once we have installed VirtualBox we cannot start testing right away. First, it is necessary to create a secluded place where your software will be alone to test it.
First, open Virtual Box and click “New” to create a new virtual machine. You will also need to download the ISO file according to the OS you want to try
Then, install the operating system of your choice, in our case we will choose Windows, onto the VM
Before you install anything else, take a snapshot. This will allow you to revert to your original install, without any change of states, after you are done testing.
For a more visual representation, here you can find a video by TechGumbo on How to Use VirtualBox (Beginners Guide).
Screenshots on how to create a new Virtual Machine in your computer step by step:
NSIS stands for Nullsoft Scriptable Install System. It is a professional open source system to create Windows installers. It Here you can read the license.
DISCLAIMER! I decided to use NSIS due to the features it has to offer, but please note that there are a lot of other Installation softwares, such as WiX Toolset or Inno Setup which can be more suitable for you. Some of them are mentioned in sections below with tutorials so you can also learn about them
NSIS is small and flexible, which makes it very suitable for internet distribution. It also has many plug-ins and scripts available to create web installers, communicate with Windows and other software components, install or update components, its custom dialogs and interfaces, multiple languages available, support for web installation and file patching, project integration and different releases and automatic builds, its portable compiler, it’s easy and understandable design, and more.
The most important aspects you have to remember of NSIS are:
It’s main selling point is it small size, which makes it fast and efficient
Compatible with all major Windows versions, from Windows 95 to Windows 10
Unique compression methods, from ZLib to, what’s most important, LZMA. LZMA is the best compressor nowadays since it has the best results with difference
Multiple languages in one installer, and you can also create your own language files
Many features and checks for the target system, with your own creation of scripts
Custom dialogs and interfaces, from custom wizard pages to your own custom interface
Plug-in system, written in C, C++, Delphi or any other language
Support for web installation and file patching
Project integration, different releases and automatic builds, which allows you to easily integrate multiple projects into a single installer or automatically generate installer builds
Easy and understandable design.
To see the full features of NSIS, here you have a link to the section dedicated to them from NSIS’ web page.
The following images will show you all the steps to install NSIS. In addition, I will show you how to install a package to help you with the creation of scripts for NSIS.
First of all, you have to go to the download page, you have the link here. In this case, we are downloading the version NSIS 3.05, released December 15th 2019. Here you have the release notes. You just have to click “Download” in bold letters under the release date and version.
Once downloaded it, you just have to click the downloaded file, called “nsis-3.05-setup.exe”. You will find this file in the “Downloads” directory unless you have specifically changed the directory path or saved it elsewhere. Double click on it and the NSIS installer will start running. You will see this. Press “Next”.
Next you will be shown the License Agreement. Press “I agree”. It is advisable to read it thoroughly.
Now you will need to choose what components to install. Since one of NSIS’ main features is how light it is, you can install them all without worrying about taking up too much space. Therefore, it is advisable to leave the predefined option “Full” in the “Select the type of install”. It will only require 7MB. Press “Next”.
Then, you will have to choose the Install location. It is also advisable to leave the destination folder as it is, but you can change it if you want to. Press “Install”.
It will show the following, with a bar loading to show how the install is going. It will take no time due to its size. Press “Next” once the install has finished.
Your software is ready to use! Now you can choose whether you want directly to run NSIS and/or show the release notes. It is advisable to only “Run NSIS” and to untick the other box, this way you can test if NSIS is working well. Press “Finish”.
Once you run it this will be shown to you.
In addition, this is what it will show you if you had chosen to see the release notes. However, you can find them in the web page too.
To uninstall NSIS, you must double click again the executable called “nsis-3.05-setup.exe”. The first you will be shown will be the same as when installing, however, at some point you will be asked “Uninstall NSIS” or “Add/Reinstall components”. Choose “Uninstall NSIS”. After that you need to choose the location where all the files related NSIS are and then click “Uninstall”. A progress bar will be shown and after choosing to “Close”, NSIS will no longer be in your computer. The following images will show you the process.
In order to do the TODOS and learn how to create scripts to create installers, we will help ourselves with NSIS Quick Setup Script Generator.
First of all, you have to download the .zip from the following web page. There is a link provided to download the package. It can be found in “Links”->”Download”, in the line that says “NSIS Quick Setup Script Generator Nsisqssg.zip (74 KB) the current release.”.
Once downloaded it, you just have to click the downloaded file, called “Nsisqssg.zip”. You will find this file in the “Downloads” directory unless you have specifically changed the directory path or saved it elsewhere. We want to unzip the file, so you will have to right-click the file and select “Extract in Nsisqssg". This will create a folder where all the scripts will be saved, both in .nsi format, .ini and .txt. If you go inside this folder, you will find an executable called “NSIS Quick Setup Script Generator.exe”. Double click it to start running. Press “Next”.
After that, the app will start showing you commands, but I will talk about them later, since from this point onwards you are already creating a script. The steps to create said script will be found below in the exercise.
There is a lot of room to improve your installers using NSIS. Since you can create your own scripts and produce all the content you need for your own Installer. In addition, some basic scripts can be used, and always come with NSIS when installing.
When there is no built-in support for a certain operation or task in Windows Installer itself, or in any of the various third party tools available, you are left having to implement the feature yourself.
When you use Windows Installer, this involves running custom actions of various types (Windows Installer’s mechanism for running executable, custom installation logic during installation).
Custom actions are purpose built executables (binaries: dll, exe) and scripts capable of making advanced modifications to the system during installation that are not supported by Windows installer natively or by the deployment tool in use (WiX, Installshield, Advanced Installer, etc…).
There are different custom action types: implemented as scripts (JavaScript, VBScript), .NET binaries (C#, VB.NET, DTF,…), PowerShell scripts, etc.
Custom actions that make modifications to the system run with elevated rights so that changes can be made to the system even if the logged on user does not have admin rights. There is essentially no limit to what these custom actions can do. They are armed and dangerous.
Custom actions are the leading causes of deployment errors and failure.
To start with your Installer, as obvious as it may be, you have to install the software first. Above this section you can find how to install NSIS, the program I will be teaching you how to use in order to create an Installer for your game, software and others.
In the first step, to get familiar with NSIS, I will be teaching how to create an executable (.exe) from a .zip. Since this research is aimed mostly to the games developed in the subject Project II taught at CITM and they are delivered in .zip and also are released in Github in the same format, I thought it was a previous step that would be nice to get to know the software and how it works.
Now that you already know how to create a very basic Installer, without Icon or any personalization, I will introduce you to .nsi scripts to do so. First of all, they can be created and work from any text editor, so you don’t need to install any other softwares. However, bear in mind there are some programs which can help you with scripts. Note though that these scripts have a language you will have to learn. Here you have a summary.
After that, we are going to create a script with a script generator, as said before. This will include Licenses, app’s name, installer’s name, directories, and more.
Finally, I will teach you in the final TODOs how to add an icon to an installer or how to personalize a little bit your Installer’s UI, in our case, adding and image. However, you can do much more, and here you have a link to other personalization features.
Pro tip! If you are using Visual Studio, you can press Ctr+Shift+F and look for “TODO” in all your code. This way you will find the exercises in the code easier
Disclaimer! You can find the solutions below.
After opening NSI, you are shown different “links” that will take you to different parts of NSIS depending on what you need to do for your Installer. You will have to choose the option from the “Compiler” you believe will lead you to create an executable from a .zip file. Once there, you will need to choose from which .zip you want to take the files of your software, the name of the installer and the default folder. Then, choose “LZMA” and generate your file. You have it!
Here you have a summary of .nsi language.
Here you can find a link to a script with basic syntax errors in this language. Find them all so that it works.
You will need an icon (.ico). It is advisable it is inside your game’s assets folder.
You need to add an icon to your game. Look at all the types of files you can add and see if you can find something to add this resource. Then import your icon.
As said before, we will use this software provided by NSIS to create a basic script. Open the executable and play with it. The interface is very intuitive. After completing all of the fields, you will have your first script in NSIS. Of course, you may not understand some part or if you can leave a field blank, etc, so an explanation on how to use this software can be found in the solutions below.
You will need a bitmap (.bmp).
In this TODO I will remind you of some .nsi syntax. You will have to add a .nsh for the MUI to control the interface (UI Dialog). In this case, you have to add a “header image” to personalize your interface. You will have to use “!define” and you must do it under the !include “MUI.nsh”. Bear in mind the localization of your script, since in the previous step you chose a directory to both save the .nsi file and a directory where your installer will take the files from.
You will need an icon (.ico). (If it complains about your icons check this information)
In this TODO You will have to add a .nsh for the MUI to control the interface (UI Dialog). In this case, you have to add an “executable image” to personalize your setup software. In this case you will have to “!define” an icon. Bear in mind the localization of your script, since in the previous step you chose a directory to both save the .nsi file and a directory where your installer will take the files from.
Here are all the screenshots on how to do it. First you need to select “Installer based on .ZIP file” under the “Compiler” section. A new window will be opened. You will need to look for the .zip in “Open…”, which will let you browse in your computer. You can then change your installer name and choose the interface design (I left it at “Modern” since it’s what we will be using) and then select the “Output EXE File”, which if you click “Browse…” you can look for it and select it in your computer. I recommend you to leave LZMA in “Compression” since it’s the most efficient out of all of them. Press “Generate”. You now have your installer, which should look like the last picture.
See the screenshots:
If you need more help, here you have a Youtube video Tutorial by Ivan Angelkoski that may help.
Here you can find the script without errors and small explanations. Remember that “;” is used to comment, so the explanations will be after them.
First you need to open Visual Studio. In a folder of your choice (choose wisely), you will be adding your icon. In my case I chose the “tools” folder. Right-click the folder, choose “Add” and then “New element”. Go to “resources” on the left and add a ,rc file, you can change the name. Press “Add”. Then right-click again and choose “Add resource”. Select “Icon” and “Import”. Browse in your computer the .ico you wish to be the icon for your game. Now you just have to run the code! Bear in mind that, if you run it in “Debug”, it will only change the icon in the Debug’s executable. It will happen the same with “Release”.
Here you have the screenshots of every step:
Here there is an explanation on how to use Quick Setup Script Generator.
AS stated beforehand, to use this software you just need the executable. Once done, all your scripts will be saved into the same folder, but I’ll get to that later. Open the executable and Press “Next”.
Here is where you will start creating your script with the help of your software. In this section you are asked for a “New project name”. You can also “Load a previously saved project”, but since we are creating a script from scratch we will not use that feature. Here you can write down the name of your game, in my case Test_Game_Pong. The following two images are used as a how it is first shown and what I have written for the example used in this research. Press “Next”.
Now, you have to put a lot more information about your software. You will need to write in each field You game name, who developed it, under which license, the version it is done for, etc. There are some fields you don’t have to fill, like the license one. I recommend you choose in the compression type LZMA, since it’s top one at the moment. To add a License, you will need it in .txt format; you just have to press the the button next to it (it has “…”) and browse in your computer to add it. I also recommend you to choose “Install for all users”. You can see how I filled out the information and what is shown before changing anything. Press “Next”.
In the next step, you are going to basically select what’s going inside the end-user. You will need to look for the executable first. In the “Main exe” section, you need to press the button “…” and browse through your computer for the game’s executable. Then, in “Add files”, you will need to add what the game or software needs to run. In our particular case, in the Pong game provided, there is a folder called “Game”, with 2 different folders. You need to browse clicking “…” and add “Game”. Then, next to the “…” button, you have to tick “Include subdirectories” in order to also add all the files which are in other folders inside “Game”, the main folder. You don’t need “Additional Installation Files” in this case, but you can do it in this section too. Press “Next”.
Before generating the script, you will need to say how you want the Start Menu and set the compiler preferences. In this case, I chose to tick to “Create a desktop shortcut as well”, to add a shortcut of the game in the end-user computer’s desktop. This is what’s most important about this section with the compiler preferences. For the other ticks, I chose to also tick them in order to give the end-user more options, but it will depend on your needs, which may not be the same as mine. In the “Compiler Preferences” section you will be choosing where to save your Installer and its name, which you don’t need to touch at all and it will be automatically set to “setup.exe” in the folder you first opened NSIS-QSSG. It’s important to tick “Save compiled script for further editing”, since we will be adding things in the following TODOs. I also chose to “Also open up saved script in editor” to continue working. Press “Generate”. You will be asked “Do you want to save/update the current project settings?”, say “YES”.
Shortly after, the script will start generating and a pop-up will say it is “Done!”. Press “Accept”. Then Press “Close”.
Here you have your script!
As said, everything will be saved in the NSI-QSSG folder in your computer. The following files will be generated (the name is for the game and code I provided):
If you want to edit your file again with NSIS-QSSG you will need to open the .ini file. To continue working to add your own code, you will need the .nsi file.
THIS IS HOW YOUR INSTALLER SHOULD LOOK NOW
Here, as said before, you have to add an image to the heather. You must add it after “MUI.nsh” is added, since what we need is inside it.
We will add it just after “MUI.nsh” to avoid conflicts. You will need to define !define your variable/function. This first line is to initialize, the second one is asking for a bitmap (.bmp) and the third one is for the position. In our case, we have the image in the same folder as the file and “Game” foder, so there’s no need to write the directory. If you need to, “FolderName/Image.bmp” is how to do it.
To add an icon to your installer we are also using MUI, therefore, it will be written just below the previous TODO. It works in the same way the Bitmap image for the heather (TODO2, second line), you are defining and icon, so you have to add “Icon.ico” and in case it’s not in the same folder, you will need to add the path.
THIS IS HOW YOUR INSTALLER SHOULD LOOK NOW
This last picture shows the files I have in my folder at the moment.
Pro tip! After all the TODOs, to create your working Installer, you need to open NSIS and choose the option below “Compiler” called “Compile NSI scripts”. This will open a new window. In “File” you have choose “Load script” and choose the .nsi file you want to create your installer from. It will run automatically: red if your code doesn’t compiler, orange if there are warning and green if neither of those. Your installer will be generated automatically and you can Press “Test Installer” to see how it works.
Here you can find the link to the exercise
Here you can find the final result
Here you can find the solution
If you want to Import a root certificate, you can go to the following link where it is explained how to do so silently.
To continue learning about installers, I propose that you do those exercises on these other installers, which are WiX Toolset and Inno Setup.
Inno Setup is a free installer for Windows programs. Here you can see its features, from where I will highlight the support they offer, the creation of a single EXE and customizable setup types, as well as uninstall capabilities, shortcuts, multilingual, supports encrypted and passworded installs as well as digital signs, and its full source code is available from GitHub. Here you will find its documentation. Here you can read the license.
WiX Toolset, is short for Windows Installer XML Toolset, is a free software toolset that builds Windows Installer packages from XML. For those which are not familiar with XML, it is a markup language (a system for annotating a document in a way that is syntactically distinguishable from the text, which means that, when the document is processed to display it, the markup language, what you have written, it is not shown, since it is only used to give format to the text) widely used, remarkably because it is used across the Internet. It uses C++ and C# and the target OS is always Windows, as the name itself indicates. In the following link you can go to the official web page of WiX Toolset. The following link leads to the official web page of WiX Toolset. MSBuild is supported from the command line, Visual Studio, and Team Build and includes several extensions that offer functionality beyond that of Windows Installer. You can also create setup bundles that install prerequisites like the .NET Framework and other runtimes along with your own product. In addition, you have custom actions, where you can code if you want to go further in your Installer. In the following link you can go to the official web page of WiX Toolset, to the WiX Improvement Proposals. If you want to master WiX Toolset, the following links will lead you to other tutorials which may be useful:
Here you have another very simple tutorial aimed at those with NO PREVIOUS EXPERIENCE in using Advanced Installer, using the Freeware edition. However, this tool, which is very powerful and easy to use, it is only available on trial for 30 days, after which you have to pay.
Here are the links and references where I got all the information I used to create this research.
Some of the images were taken from Google Images. All the screenshots for the tutorials were done by me. Credit goes to their respective authors.
About Automated Builds:
About other tools to create a Windows Installer Package:
About Deployment and Automated Builds: - Automated Builds - Automated Builds CI/CD - Pdf Element: Best 5 Software Deployment Tools for Enterprise