Inno setup
There are many different freely available software you can use to create a setup file. I advocate the use of Inno Setup by Jordan Russell Software. Indeed, this was the first one I used and I have stuck with it ever since.
Inno Setup will create a single Exe file which will contain the setup up information for all files needed by your software.
In this section, we will look at how to create a simple instillation file. In the section that follows, we will consider some of the more advanced features of Inno Setup.
To get started, please download the following two files:
- Inno setup
- Demo project by going here
Once you have downloaded the above, do the following:
- Please first install Inno Setup.
- Unzip the demo project and browse to \code\setup
In the \setup folder, along with the files needed to make Color Crazy.exe work, you will find:
- Setup.iss - this is a script file created in Inno Setup. It scripts how the installer (to be compiled by Inno Setup) should function.
- \Output folder - this is where the compiled setup file is stored.
A little about the Setup.iss file above: I created the Setup.iss file by using the Inno Setup script wizard. Inno makes references to files absolute. I thus modified a few lines to make sure all paths were relative.
Also, please note that we have added a [Code] and [Registry] sections which are not produced by the wizard. More information is available under Advanced Inno Setup.
You may now want to open the Setup.iss file and explore its contents. You can also compile it and then browse to the \Output\ folder where you will find Setup.exe. Please keep a back up of this file because you may want to refer to it later.
In order to create your own basic setup file, it is best to use the Inno Setup script wizard. You can then modify this basic script as required. Here is a walk-through of how I created the above Setup.iss file.
- Open Inno Setup
- On the window that appears “Create a new script file using the Script Wizard”. Then click OK.
- Click next
- Enter the application name (Color Crazy), application and version (Color Crazy Version 1.0), application publisher (SSOF Software) and your website (http://www.sell-software-online-free.com/color-crazy/). Then click Next.
- On Application Folder name, enter your company name (SSOF Software). Click Next.
- On this window, click Browse. Browse to the where the main application EXE is and select it. (In this case, Color Crazy.exe)
- Click Add folder… Browse and select the \Settings\ folder. Click Yes on the Confirm window. Then click Next.
- You also need to add the files Help.chm, krm.dll and License.rtf by clicking on Add files.
- Tick “Create an Internet shortcut…” and “Create an Uninstall icon…”. Click Next.
- On the License file section, click Browse. Browse to where the license file is and select it (in this case, License.rtf). Click Next.
- Tick English and click Next.
- Do not change anything on the Compiler Settings window. Click Next.
- Click Finish
- Do not compile (click No). You will now see the scrip that has been created. Save the file (File -> Save) to the same directory as where the other files are (i.e. same directory as PictureView.exe).
Now, the first thing I do is to change all the paths in the script to a relative path (this means that when files are moved, Inno will know where exactly where to look. To do this, change the following lines as follows (note, your default paths may be different):
- “LicenseFile=D:\WEB\Software design\Files\proj\License.rtf” to “License.rtf”
- “Source: “D:\WEB\Software design\Files\proj\Color Crazy.exe”; DestDir: “{app}”; Flags: ignoreversion” to “Source: “Color Crazy.exe”; DestDir: “{app}”; Flags: ignoreversion”
- “Source: “D:\WEB\Software design\Files\proj\settings\*”; DestDir: “{app}”; Flags: ignoreversion recursesubdirs createallsubdirs” to “Source: “settings\*”; DestDir: “{app}”; Flags: ignoreversion recursesubdirs createallsubdirs”
- Source: “LicenseFile=D:\WEB\Software design\Files\proj\Help.chm”; DestDir: “{app}”; Flags: ignoreversion to Source: “Help.chm”; DestDir: “{app}”; Flags: ignoreversion
- Source: “D:\WEB\Software design\Files\proj\krm.dll”; DestDir: “{app}”; Flags: ignoreversion to Source: “krm.dll”; DestDir: “{app}”; Flags: ignoreversion
- Source: ” D:\WEB\Software design\Files\proj\License.rtf”; DestDir: “{app}”; Flags: ignoreversion to Source: “License.rtf”; DestDir: “{app}”; Flags: ignoreversion
You will need to make one final change to get everything working. This is line 3 above which should currently read:
- “Source: “Settings\*”; DestDir: “{app}”; Flags: ignoreversion recursesubdirs createallsubdirs”.
You should make it read:
- “Source: “Settings\*”; DestDir: “{app}\Settings”; Flags: ignoreversion recursesubdirs createallsubdirs”
This change will ensure that the contents of the pictures folder are put with the “Settings” directory within the location that the user installs the application in {app}.
Save the file now! Save it in the same directory as where you have rest of the project files (in the case of Color Crazy, the \setup folder). The location where we save this file is important because the paths have been made relative!
Now click on Run (Green toolbar button) to compile and run the setup file (the setup file is created in the \output\ folder at the location where the script file is saved.)
That’s it! You have successfully created a setup file! After installing the setup.exe file, you should go to the Windows Start Menu and see what shortcuts have been created. Note the uninstall shortcut. Run the program and see how it reads from the Pictures directory.
Of course, Inno Setup is much more powerful, but what is given above should be enough to create setup files for basic applications. On the following section, we will have a look in detail at some common tasks.
