Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm using Visual Studio 2008 with C++ and the built in setup facility. Is there any way to create a setup project that will install a 64 bit application on a 64 bit target machine / OS and a 32 bit version when run on on a 32 bit target machine / OS?
Posted

1 solution

If you are using MSI-based technology (based on Microsoft Installer and its API), you obtain MSI which is marked by its target instruction-set architecture, one 32-bit and at least two incompatible 64-bit ones. A 32-bit MSI can be installed on any platform, but a 32-bit system won't be able to install MSIs targeted to any other instruction-set architecture.

So, it looks like the only option is to generate 2 or 3 different MSIs for different architectures. (I use only WiX framework; if you are interested how to do it in one project, I can explain it.) The usual practice is to have Setup.EXE which determines the current platform's architecture and run one of the available MSIs depending on it (or it may provide a choice between valid some options; an application can be installed as targeted to native 64-bit platform, as as a 32-bit for 64-bit platform, to be run on WoW64).

(Please see: http://en.wikipedia.org/wiki/WoW64[^].)

Maybe I don't know something, but I see some kind of defect in it: it looks like MSI system cannot address such thing as installation of the .NET products targeted to "AnyCPU", which is possible in .NET, due to the use of JIT compilation. The same goes for Java. You can actually install the "AnyCPU" product using 32-bit MSI, but the defect is: the product will be installed to "Program Files (x86)", which is not quite valid. Interestingly, if your MSI allows for custom target directory (highly recommended) and the user removed it " (x86)", the installed still changes it to "Program Files (x86)" on the 64-bit platforms again! What a lame! The application still works as native 64-bit one. This is yet another reason to have different MSIs for different architectures even for a pure "AnyCPU" project. Ugly, but works more correctly.

—SA
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900