mozilla

# Creating a Windows Inno Setup installer for XULRunner applications

A XULRunner application has no installer by default; however, these instructions can help you to easily create a Windows installer with Inno Setup. The tutorial here uses the My App example from the article Getting started with XULRunner.

## Step 1: Installing Inno Setup

Download Inno Setup from Inno Setup Downloads. If you only want to compile the installer, install the stable release. If you want to edit scripts, you should get the QuickStart Pack (which includes ISTool, the script editor. However, if you don't get the QuickStart Pack, you can later get ISTool from Inno Setup Third-Party Files.

## Step 2: Creating the application

To make your application standalone, deploy your application according to the Deploying XULRunner 1.8 article. My App's example follows.

• `myapp/`
• `application.ini`
• `chrome/`
• `default/`
• `myapp.exe` (copy `xulrunner-stub.exe` and rename)
• `xulrunner/`

Please test your application before deploying it. If your application does not run, neither will the installed version.

## Step 3: Creating the Inno Setup script

Create an Inno Setup Script (.iss file). The Inno Setup Script Wizard can't set chrome directory's deployment point, so you have to edit the iss file yourself. Also you had better set the `AppName` and `AppPublisher` properties to the same values specified in your XULRunner application's `application.ini` file.

My App's .iss file sample as follows:

```; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

[Setup]
AppName=My App
AppVerName=My App 1.0
AppPublisher=Mark Finkle
AppPublisherURL=http://developer.mozilla.org/en/docs/Getting_started_with_XULRunner
AppSupportURL=http://developer.mozilla.org/en/docs/Getting_started_with_XULRunner
DefaultDirName={pf}\My App
DefaultGroupName=My App
AllowNoIcons=yes
OutputDir=..\build\output
OutputBaseFilename=myapp-1.0-win32
; SetupIconFile=
Compression=lzma
SolidCompression=yes

[Languages]
Name: english; MessagesFile: compiler:Default.isl

[Components]
Name: main; Description: My App; Types: full compact custom; Flags: fixed
Name: runtime; Description: XUL Runner Runtime; Types: full custom

Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked
Name: quicklaunchicon; Description: {cm:CreateQuickLaunchIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked

[Files]
Source: C:\develop\XULRunnerInstaller\myapp\myapp.exe; DestDir: {app}; Components: main; Flags: ignoreversion
Source: C:\develop\XULRunnerInstaller\myapp\application.ini; DestDir: {app}; Components: main; Flags: ignoreversion
Source: C:\develop\XULRunnerInstaller\myapp\chrome\*; Excludes: .svn; DestDir: {app}\chrome; Components: main; Flags: ignoreversion recursesubdirs createallsubdirs
Source: C:\develop\XULRunnerInstaller\myapp\defaults\*; Excludes: .svn; DestDir: {app}\defaults; Components: main; Flags: ignoreversion recursesubdirs createallsubdirs
Source: C:\develop\XULRunnerInstaller\myapp\xulrunner\*; DestDir: {app}\xulrunner; Components: runtime; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: {group}\My App; Filename: {app}\myapp.exe
Name: {group}\{cm:UninstallProgram,XUL Explorer}; Filename: {uninstallexe}
Name: {userdesktop}\My App; Filename: {app}\myapp.exe; Tasks: desktopicon
Name: {userappdata}\Microsoft\Internet Explorer\Quick Launch\My App; Filename: {app}\myapp.exe; Tasks: quicklaunchicon

[Run]
Filename: {app}\myapp.exe; Description: {cm:LaunchProgram,My App}; OnlyBelowVersion: 0,6; Flags: nowait postinstall skipifsilent

```

## Step 4: Building an installer

Once your script is ready, start the Inno Setup Compiler, load the script file, and compile it. This will create the compiler, which you need to test by actually trying to install your XULRunner application. Don't forget to then test the installed application to be sure the installation did indeed work correctly, since if you accidentally omitted resources from the script, they'll be missing from the installed package. If your application starts up successfully, your installer worked correctly.

## Original Document Information

• Author: Taro Matsuzawa
• Inno Setup Script Original Author: Mark Finkle
• Japanese version is original.