Pages

Thursday, April 7, 2011

Creating setup files using Inno Setup

Back with a 'programming' post after quite sometime.

I have been searching a free tool that lets me creates setup file for quite sometime. I used 'Install Maker' & 'Install Creator' while i was in college. They were never sufficient. Install shield is probably the widely used tool in the corporate world, but there are the problems of purchasing license with that.

I found Inno Setup when i was browsing the Wampserver's forum. After playing around it for sometime, I could understand the power of this free tool. It has a decent set of features and yet remains intuitive and very simple. It might take some time to understand how to get started, but once you cross that stage its a pleasure working with this tool.

Let us a very small example here where you want to install an application that you have written. As a part of the installation, you want to do the following.

  1. Copy your executable(s) and place it in the folder specified by the user during installation. {HelloWorld.exe}
  2. Install a font in the PC. This font shall be used by your application when it runs later. {HelloWorld.ttf}
  3. Create a registry entry.
  4. Restart the PC once installation is complete.
#define MyAppName "Hello World"
#define MyAppVersion "1.0"
#define MyAppPublisher "Rmn"
#define MyAppURL "http://rmn-explores.blogspot.com"
#define MyAppExeName "Hello World.exe"

[Setup]
AppId={{D008C041-E0FA-4D83-9154-D458909FD58A}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes
AlwaysRestart=yes

[Registry]
Root: HKLM; Subkey: "Software\HelloWorld\Settings"; ValueType: string; ValueName: "InstallPath"; ValueData: "{app}"

[Files]
Source: "D:\HelloWorld.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\HelloWorld.TTF"; DestDir: "{fonts}"; FontInstall: "Hello World Font";

[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon

The 'Setup' section gives basic info about your setup file name. All these information will be displayed when the installation wizard is run. The 'AlwaysRestart' attribute in the setup section indicates the system must restart after the installation is complete.

The 'Files' section specifies the list of files that need to be copied to the PC during the installation. Pre defined constants appear within the { }. In this case {app} refers to the folder destination chosen by the user in the wizard. The second line in the 'File' section installs a font in the system.

The 'Registry' section mentions the entries that need to be created during the installation. The initial values can be put in there too.

And finally, the 'Icons' section specifies if you need to create a desktop shortcut to the application or not. You can specify if you need to have a icon created in the programs menu.

Once this script file is ready, you need to compile it using the ISS compile that comes with the installation and your setup is ready.

Other options such as registering com dlls, running batch files are also available. The documentation that comes with the setup covers most of it.

2 comments:

Anonymous said...

timberland boots, soccer shoes, nike roshe, asics running shoes, oakley, juicy couture outlet, beats by dre, new balance, jimmy choo shoes, vans, north face outlet, instyler, mcm handbags, abercrombie and fitch, baseball bats, hollister, karen millen, gucci, lancel, bottega veneta, valentino shoes, louboutin, reebok shoes, north face outlet, converse outlet, hollister, herve leger, juicy couture outlet, ralph lauren, ferragamo shoes, insanity workout, ghd, nike air max, mont blanc, chi flat iron, nfl jerseys, toms shoes, supra shoes, mac cosmetics, converse, babyliss, wedding dresses, celine handbags, ray ban, vans shoes, nike air max, montre pas cher, soccer jerseys, p90x workout, birkin bag

Anonymous said...

vans pas cher, michael kors outlet, mulberry, michael kors, sac guess, new balance pas cher, ugg boots, nike air max, true religion outlet, hogan, true religion jeans, burberry, hollister, hollister, oakley pas cher, true religion jeans, coach purses, michael kors outlet, timberland, ray ban uk, converse pas cher, north face, burberry outlet online, longchamp, michael kors, nike huarache, michael kors outlet, tn pas cher, ray ban pas cher, michael kors outlet, michael kors outlet, hermes, air force, lululemon, nike blazer, lacoste pas cher, michael kors, nike trainers, ralph lauren uk, nike air max, nike roshe, nike air max, michael kors, north face, vanessa bruno, ugg boots, true religion jeans, hollister pas cher, nike free run uk, abercrombie and fitch