Using InnoSetup to Build an Installer for Your Apps

For many years, REALbasic was able to generate single-file Windows executables. It was a great selling-point. Unfortunately, as of REALbasic 2008 Release 2 this feature is no longer available. I won’t go into why, as Aaron Ballman explained the reasons quite well in a blog post from last spring.

The REALbasic community hasn’t been entirely supportive of this change, however. Some welcome the added stability it offers, but others (who never witnessed the odd crashes) are greatly upset by this change. A quick read of the forums or NUG turns up a thread on this about once a month it seems.

I’ve been completely unaffected by this change for two reasons. One, I do all my development on Mac OS X. This change didn’t alter how builds on done on Mac OS X. Second, I’ve always shipped Windows builds to my clients using an installer. It was a pretty trivial change to have the installer include both the EXE and the new folder of DLLs. From my clients’ point of view, nothing has changed at all.

I use InnoSetup as my installer. It’s free and pretty simple to work with, once you create your initial installation script. To help those folks out who might be a little intimidated by using an installer, here is a sample InnoSetup script that is based on the scripts I use to build my Windows installers.

To start, download InnoSetup and install it.

Now run it. At the welcome screen, choose “Create a new empty script file” and then click OK. Now copy the text below and paste it into the editor (you can also download this script from ARBP):

; Sample script for create an installer for a REALbasic application
; Paul Lefebvre
; LogicalVue Software, Inc.
; November 2008

; To use this script, replace "REALbasicApp" with the name of your REALbasic application.

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{B104D606-3C81-45CF-A209-82C315FF3752}
AppName=REALbasicApp
AppVerName=REALbasicApp 1.0
AppPublisher=REALbasicApp Company
AppPublisherURL=
AppSupportURL=
AppUpdatesURL=
DefaultDirName={pf}\REALbasicApp
DefaultGroupName=REALbasicApp
OutputDir=C:\Users\You\REALbasic\REALbasicApp\Installer
OutputBaseFilename=SetupREALbasicApp
; If you have an End User License Agreement (EULA) that you want the user to agree to before letting the install continue,
; put the path to it here.
LicenseFile=
Compression=lzma
SolidCompression=yes

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

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

; These directories will be created by the installer inside the DefaultDirName (defined above).
[Dirs]
Name: "{app}\REALbasicApp Libs"

; These are the files to include.  By default you want to include the EXE and the Libs folder
; but you can include any other files you like as well.
[Files]
Source: "C:\Users\You\REALbasic\REALbasicApp\REALbasicApp\REALbasicApp.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\You\REALbasic\REALbasicApp\REALbasicApp\REALbasicApp Libs\*"; DestDir: "{app}\REALbasicApp Libs"; Flags: ignoreversion recursesubdirs createallsubdirs

; NOTE: Don't use "Flags: ignoreversion" on any shared system files

; Creates icons/links in the Start Menu and/or the desktop if the user chooses during installation.
[Icons]
Name: "{group}\REALbasicApp"; Filename: "{app}\REALbasicApp.exe"
Name: "{commondesktop}\REALbasicApp"; Filename: "{app}\REALbasicApp.exe"; Tasks: desktopicon

; Give the user the option to run the app after the installation is finished.
[Run]
Filename: "{app}\REALbasicApp.exe"; Description: "{cm:LaunchProgram,REALbasicApp}"; Flags: nowait postinstall skipifsilent

Lastly, change all occurrences of REALbasicApp.exe to the name of your REALbasic application. I keep the REALbasic build in a folder inside my User folder on Vista, so you’ll also need to replace C:\Users\You\REALbasic with the path to the REALbasic build.

Once you do that, you can then select Build->Compile from the menu (or click the toolbar button) to create the installer file. InnoSetup is quite fast, so you’ll have your installer in just a few seconds.

No go to the Installer folder and you’ll find your Setup file. That’s all you need to give to your clients/users. Obviously for more complicated applications that have additional files, you’ll need to update the script to also include them, but that’s pretty easy once you get the hang of it. And I’m just scratching the surface of what InnoSetup can do. You might also want to take some time to study its help file as well.

If you’re not already using an installer, do give this one a try. Your clients and users will thank you for it.

And if you really, truly would still would prefer to have a single-file EXE, you might want to give REALbasic Application Packager a try. This free tool (from MonkeyBread Software a try) can be downloaded from here:
http://www.monkeybreadsoftware.de/realbasic/plugin/

I haven’t used it myself, so I don’t know how well it works.

3 Responses to “Using InnoSetup to Build an Installer for Your Apps”

  1. Bob Keeney says:

    Great tutorial, Paul!

    You’ll need a membership to ARBP to get to the file mentioned above. The great thing is that a Trial Membership is FREE!

    Bob Keeney
    President ARBP

  2. Steve Garman says:

    Thanks for the script, Paul. Just a couple of comments about the AppId
    1) it seems to have an extra opening brace {
    2) it might be worth mentioning in your blurb (as well as in the script comments generated by ISTool) that we should generate a new AppId GUID for each application.

  3. Paul Lefebvre says:

    Thanks for the comments, Steve.

    1. The extra opening brace does appear to be needed by InnoSetup, but I don’t know why. I think it might be used as an escape char.

    2. Yes, it is important to generate a new AppID for each app. If not, you’re installers won’t work right. I’ll update the article text when I’m back in the office.