Building 32-Bit and 64-Bit Installations from the Same InstallShield Project

If you are writing applications for 64-bit Windows-based systems, you will need a way to install your 64-bit files and other data. Although 32-bit installations run on 64-bit machines, they cannot install to 64-bit locations.

The Windows Installer (MSI) service provides support for 64-bit installations. These installations can be designed and built on 32-bit machines, but they can run only on 64-bit machines. Through the use of release flags, you can build two installations (one 32 bit and one 64 bit) from a single project.

Release Flags

If you want to build two installations (one 32 bit and one 64 bit) from a single InstallShield project, consider using release flags. You can assign release flags to features, InstallShield prerequisites, and chained MSI packages, as necessary, to differentiate the 32-bit items from the 64-bit items.

Then you can configure each release or product configuration in the Releases view to include or exclude certain items that have a particular release flag at build time. You can also conditionally launch certain custom actions based on release flags, so that 32-bit custom actions are launched during a 32-bit installation and 64-bit custom actions are launched during a 64-bit installation.

The first step is to define a feature structure that separates the 64-bit binaries from any 32-bit binaries and other files common to either installation.  Commonly this looks like below:

Blog1

In the above example, you’ll note the presence of the ‘Release Flags’ property.  This is the value to be used in the next step to conditionally include this feature in the build based on which release is being built.

For this project, a corresponding flag is set on the x64Bins feature, ‘X64’, and no flag is present on the ‘CommonFiles’ feature since it should always be included.

Below is what the individual releases will look like.  You’ll note that the X86 and X64 flags correspond to separate release configurations, which is necessary since the Template Summary property can only be overridden at the Product Configuration level to mark an MSI package as 64 bit.

Blog2

When setting a release flag, it is not strictly necessary to use capitalization.  However, this value is indeed case sensitive, and must match on the features being included in this release/product configuration.

Redirecting INSTALLDIR

There are a number of reasons why a setup developer may want to have both sets of binaries targeting the same Directory Table entry.  Most commonly, this is because a large number of common files should follow the main installation directory regardless of if it installs to ProgramFilesFolder or ProgramFiles64Folder.

It becomes in this case possible to redirect a folder dynamically using a single SetProperty custom action conditioned off of a property that InstallShield sets with release configuration information.  Typically, using the following settings verbatim are sufficient for most projects:

Blog3

The usage of the syntax used with the ISReleaseFlags property can be found with other detailed tips in the MSDN Article Conditional Statement Syntax. This can be applied to other custom actions or components as necessary.