October 20, 2012

Want to avoid 32bit installation on 64bit machine when you maintain a single project for both 32bit and 64bit?

If you are looking to maintain single project for 32bit and 64bit installers and want to avoid 32bit installation on the 64bit machine. You can do it using the following steps.

Step1: InstallScript function needs to be created. As follows

 // Function Delaration
export prototype MyFunction(HWND);

 // Function Definition
function MyFunction(hMSI)
// To Do: Declare local variables.
NUMBER nvSize;
begin
nvSize = 255;     
MsiGetProperty (hMSI, "VersionNT64", svVersionNT64, nvSize);
//MessageBox(svVersionNT64, WARNING);
if ( svVersionNT64 != "" ) then
                MessageBox(@IDSD_WARNING_64BIT, WARNING);
endif;
end
 
Step2: Define this in you String Table.
IDSD_WARNING_64BIT, WARNING = The 64-bit version of Windows has been detected. Installation of this [Product] on this platform cannot proceed, and will be cancelled. Please install this version of SecureDoc only on a 32-bit version of Windows platform.

Step 3: Create an InstallScript Custom action.
Call the above created function in this custom acation.
This custom action this should called after AppSearch in the Install Exec Sequence with the following condition ISReleaseFlags><"MyReleaseFlag" .

Note: This code sample applies to Basic MSI Projects and verified with InstallShield 2010, 2011. 2012 SP1 and 2012 Spring Edition.