The context: I have a solution that contains amongh other C# projects, a VC++ project that suports compiling only as x64 or Win32 (but not Any CPU). In order for the application (which in fact is 开发者_JAVA技巧a macro for a third party application) to run, it requires Visual C++ Runtime libraries (x86) or (x64) (The macro will run on both x64 and x86 operating systems.)
The problem: I want to create a Visual Studio setup project that would install the macro on both x86 and x64 operating systems, and the problem I have is to specify what Visual C++ Runtime library to use a prerequisite. If both are selected (x64 and x86) than I have a runtime error message when running the setup.exe, as on x86 operating systems you cannot run x64 executables like the Visual C++ Runtime libraries (x64) kit is...(which the setup calls in the back). So I would need a bitness condition, or something like that to tell the setup what bitness version of the Visual C++ Runtime library to try to install...I'm not sure if this is possible, or even where such a code should be placed in the setup.
Thank you for the support, Vali
I believe that you can't deploy to x86 and x64 platforms with a single MSI built with a Visual Studio Setup Project. You have a couple of options:
1) Make two separate MSIs, one for x86 and one for x64, and require users to run the appropriate one for their platform. This is quite a common solution, and if your setup file is distributed via the internet, has the advantage of reducing the download size (since the modules for only one architecture need be provided).
2) Use an alternative tool like WiX (as suggested in the comments) or InstallShield, etc. This does provide a single installer that works on different platforms, but it's a bit harder to create and maintain.
My preference would be 1), as it's the easiest thing to rustle up using your current setup, and it's a well known installer paradigm (Microsoft tend to provide separate x86, x64, and Itanium installers for most of the products on their download site, for example).
精彩评论