Friday, February 20, 2009

Hybrid Visual Studio Installer for 32-bit (x86) and 64-bit (x64)

Recently, I came across a problem where one of our software vendors does not support a component in 32-bin (x86) but they could provide us executables (managed and unmanaged) in 64-bit (x64) that would replace the component on a 64-bit system.

The only problem is that the Visual Studio installer complains if there are 64-bit executables in a 32-bit installer and won't build (I believe the unmanaged 64-bit binaries were just warnings, but the managed code built specifically for AMD64 caused the installer to error out).

The solution:
Build the installer in Visual Studio with the TargetPlatform set to x64. Since this installer is set to x64, it will not run on a 32-bit machine. So, as a post build step, I have a program that opens the MSI database and changes the Template in the Summary Information section and changes the installer back to 32-bit. Voila, the 64-bit executables are copied to the machine during installation for whichever platform you are running on.

No comments:

Post a Comment


Ryan Kuhn