Search code examples
visual-studio-2015windows-installervisual-studio-setup-proje

Why is my service install project installing to Program Files (x86) when I select Program Files?


I am using VS2015 to build an install solution for my service. I want the program to run as 64 bit. In the solution configuration properties I have all the projects as configuration Debug, Platform Any CPU, Deploy blank.

The msi installer asks me to select a folder to install in, and I select Program Files\My Company Name

However when I try to install on a Windows 8.1 64 bit OS the installer creates a folder Program Files (x86)\My Company Name

Why?


Solution

  • Most likely because the MSI you've generated is a 32 bit MSI, which can only access 32 bit folder paths. Thus, the OS performs the redirection automatically.

    You can check the MSI package type with the free tool Orca, which can be found in the Windows SDK. The package type info of the MSI is found in the Summary Information menu. Or you can also generate a verbose log of the installation, most likely you will find in it info about the path redirection.

    Command line for verbose log generation:

    msiexec.exe /i < full MSI path > /L*V < full log file path, including log filename >

    The fact is that "Any CPU" for an MSI means you get a 32 bit MSI, which can run on both 32 and 64 bit machines. A 64 bit MSI cannot install on 32 bit machines, as you can imagine.

    Windows Installer does not support mixed MSI packages. There other setup authoring tools that build an EXE bootstrapper which bundles two MSIs, one for each architecture, and launches the correct one based on the OS running on.

    Advanced Installer can build mixed packages, as also mentioned in this SO similar/related thread. As with any dev tool, there are other options too, see the SO thread I linked above.