Saturday, February 25, 2012

By default Inno Setup always installs your application in 32-bit mode. But if your application is compiled to 64-bit binaries (at least, partly) you will, probably, want to use 64-bit mode. First thing you need to do is to specify ArchitecturesInstallIn64BitMode in [Setup] section:

[Setup]
ArchitecturesInstallIn64BitMode = x64

This means that under 64-bit processor architecture 64-bit mode will be used. You can specify Itanium architecture (ArchitecturesInstallIn64BitMode=ia64) if necessary.
Now imagine you need to use one file for 32-bit mode and another file for 64-bit mode. You can do it in the following way:

In the script above we specified to use 32-bit version of shell extension dll in 32-bit mode and 64-bit version of shell extension in 64-bit mode. Other files can be the same for 32-bit and 64-bit modes or different.
Also you can create completely different installers for different architectures. For example, to create installer specially for 64-bit architecture you need to specify:

[Setup]
ArchitecturesAllowed = x64

Other possible values are x86 or ia64. You can specify several values separated by spaces.

Wednesday, February 15, 2012

Often during program installation we need to create configuration file. In this article we will create a very simple configuration file in .ini style.
It will be created with the help of simple procedure written with the help of Inno Setup script:

This procedure creates an array of strings which consists from two strings and contains information about application folder where the program is installed and language which was selected during installation. Later this information can be used in program, for instance, we can display user interface corresponding to the selected language. Of course, number of strings can be larger than 2.
When the procedure itself is ready, all what we need is to call it. We may call it in the [Files] section:

Please note call of CreateConfig procedure after this file will be copied.
Our simple example is finished. You can check its work. In one of the next articles when we will discuss making custom windows in Inno Setup, we will describe how to save information which user types in one of the wizard windows in the configuration file, too.

Monday, February 13, 2012

One of the common tasks during installation is to copy file to some temp directory, run it and delete after that. For example, it can be some script. In our example we are creating database necessary for our application work. First part is copying the file to temp directory, this is done in [Files] section:

Note deleteafterinstall flag, it indicates the file will be deleted at the end of installation when it won’t be necessary any longer.
The second part is to launch this file at the end of installation process (of course, this takes place before deleting of the files, Inno Setup handles this correctly automatically):

[Run]
Filename: {tmp}\CreateDatabase.bat; Flags: runhidden;

Note runhidden flag here, it indicates that this operation won’t be visible for users of your installer. This flag can be removed if you prefer to leave this operation noticeable.
When your application is uninstalled, you may need also to launch a file. In our example, we need to delete database.

We are using the same flag runhidden, but now we can’t use temporary directory, we need to run from application directory or from some folder like commonappdata. The file needed for deleting database was created during process of installation in [Files] section:

Tuesday, February 7, 2012

For almost each software product we need to create an installer at some stage of development. For Windows platform there is a great solution which we are using in our own products. It is Inno Setup, a free installer which supports all versions of Windows. We believe it is even better than its commercial analogues.http://www.jrsoftware.org/isinfo.php

Inno Setup supports the majority of things you need while creating installers and the aim of this series of articles is to describe how to do some common things with Inno Setup. As far as we have made many installers using Inno Setup, we’ve figured out some typical problems and their solutions. Now we want to share them with you and provide some pieces of code which can be helpful when you will be solving some similar problems. These things will include: creating configuration files during installation, checking .NET Framework versions before installation, creating custom windows for installation wizard and many others.

Our aim is NOT rewriting of Inno Setup documentation which is enough detailed for you to understand how to do basic tasks like copying files to appropriate folders while installation.