Search code examples
visual-studio-2010windows-installersetup-projectmsvcrt

Install VC++ Runtime 64-bit if system is 64-bit


I am creating a Visual Studio 2010 Setup project for installing my application. My application works by having multiple executable for different system bitness, and detects if you are running on a 32-bit or 64-bit system.

I'd like to have the Visual C++ 2010 x64 Runtime installed by the installer if it is a 64-bit system. Setting this as a prerequisite, disables installation on 32-bit systems. Is there any way to set this as a prerequisite, but only on 64-bit systems, without resorting to two different installers?


Solution

  • You need to create separate MSI files for the 64-bit version and the 32-bit version to deal with the specialities of WOW64.

    It is not possible to have one single MSI install both a 64-bit and a 32-bit version:

    Different Packages are Required for Different Processor Architectures

    Because you will have separate MSI files it should be easy to add the 64-bit VC++ Runtime Redistributables to the 64-bit MSI and the 32-bit ones to the 32-bit MSI respectively.

    Of course, you may create a bootstrapper that checks the system architecture and then launches the respective MSI file. I believe dotNetInstaller offers such a mechanism as has been indicated in a related question.