How to create a package that will be installed like a 64-bit package on 64-bit platforms and as 32-bit package on 32-bit platforms ?
The following article uses options that are available starting with the Professional edition and project type.
Use the wizard
An easy approach is to use the Mixed 32/64-bit matching the platform wizard. The wizard is easier to use, but the advanced package structure settings are configured automatically.
Use the "Mixed 32/64-bit matching the platform" package type, without the wizard
Go to the Install Parameters page by selecting it in the left pane. Select for “Package Type” the value Mixed 32/64-bit matching the platform.
32-bit packages can also be installed on both 32 and 64-bit platforms but they can't install 64-bit binaries to real system paths on 64-bit platforms. Find out more about package types from Packages Types.
Files from your application may be categorized into 3 classes considering the machine they are designed for:
- 32-bit executables or libraries (can run on 32-bit machines) - you may want them to also be installed on 64-bit machines in order to interact with other 32-bit applications.
- 64-bit executables or libraries (can run only on 64-bit machines) - these files should not be installed on 32-bit machines.
- Machine independent files - should be installed on any kind of machine.
In the following steps we will:
- Create a folder structure to keep 32-bit files and 64-bit files as well as their shortcuts into different folders.
- Set the component types (32/64-bit) and install condition.
Creating the folders structure
Go to the Files and Folders page. Select “Application Folder” and create a new folder using the “New Folder” toolbar button. Name this folder 32-bit.
- you can place your 32-bit binaries into the "32-bit" folder.
- The 64-bit binaries and any shared resource files should be placed directly into the “Application Folder”.
Redirecting the 32-bit binaries to the root installation folder
If you don't want to install your 32-bit binaries on 64-bit platforms, and since the 64-bit binaries should not be installed on 32-bit platforms, you can redirect the 32-bit folder to install its content to Application Folder. Use the “Install folder content into the parent folder” option from the folder properties page. This way you will have a proper installation layout on both types of platforms.
If you do want to install your 32-bit binaries on 64-bit platforms, it means you must redirect the 32-bit folder to install its content to the Application Folder, but not for 64-bit platforms.
Go to the Custom Actions and add "Set directory path" custom action with sequence from the "Add Custom Action" pane. Select the "32-bit" folder under "Application Folder" and configure as follows:
- Value: [APPDIR]
- Execution Condition Expression: NOT VersionNT64
Setting the components types
Go to the Organization and select the components that contain your 64-bit binaries and mark them as “64-bit Component”. If you have difficulties finding the component that contains a certain file, you can select the file from the Files and Folders and use the “Go To Component” context-menu button.
If you don't want to install your 32-bit binaries on 64-bit platforms, select the components that hold your 32-bit binaries and condition them with NOT VersionNT64.
Go to the Files and Folders page. Select “Application Shortcut Folder” and create a new folder using the “New Folder” toolbar button. Name this folder 32-bit. The shortcuts to the 32-bit binaries should be placed into this folder and those to the 64-bit binaries should be placed into the "Application Shortcut Folder".
For the "32-bit" folder under "Application Shortcut Folder" you must do the same action as you did for the "32-bit" folder under "Application Folder" (use a custom action to set it to [SHORTCUTDIR] or use “Install folder content into the parent folder” option in case you will not install the 32-bit binaries on 64-bit platforms).
If your package contains any binary file launched as a custom action, you may want to condition them ,using the VersionNT64 property, to only be executed when desired.
If your package contains any merge modules, all their components will be installed no matter if their 64-bit flag was set or not. You can control the merge module files' installation from the Feature Properties page of its feature.