C# – Target both x86 and x64 in the Windows Installer (VS2008)

coperating systemtarget-platformvisual studiowindows-installer

Is there any way to create a Windows Installer using Visual Studio 2008 to target both x86 and x64 operating systems.

In the TargetPlatform property, I have just : x86, x64, Itanium. And I know that there is another one somewhere called Any CPU but I can't find it.

Also, I don't want to create two Setup.

Any ideas ?

Thanks.

Best Answer

It can be done, but not directly with Visual Studio. The general approach is this:

  • create a generic MSI which contains both 32-bit and 64-bit resources
  • create MST transforms (one for 32-bit and one for 64-bit) which modify the MSI based on the target platform
  • use an EXE bootstrapper to dynamically detect the platform and apply the correct transform to your MSI

You can create transforms with Orca. If you want a commercial solution, you can try Advanced Installer or InstallShield.

If this seems too complicated, you can simply use separate 32-bit and 64-bit packages.