简体   繁体   中英

Is there a quick way to switch the solution platform in Visual Studio 2010?

I want to compile my C++ projects in 32-bit and 64-bit mode. Until now, I created Solution Configurations: in addition to the pre-configured "Debug" and "Release" configurations, I then had "Debug x64" and "Release x64" configurations which I set to compile a project for the x64 architecture.

However, my latest project can be changed in a number of dimensions: Not only "Release" vs "Debug" but also "XP", "Server03" and "newer" as well as "EXE" vs "DLL" (it can actually be compiled in both formats). Because this already gives 2*2*3=12 configurations, adding another "x64" configuration for each of those would give the whole thing absurd proportions.

That's why I want to use the Solution Platform setting from now on. Unfortunately, the only way to change that seems to be to click the configuration dropdown list, open the Configuration Manager from there, then change the Solution Platform and click OK. This takes a rather long time (more than doubling the number of clicks). Is there a quicker way? Or alternatively, a better way to manage all the dimensions in which the project can change (which involve project settings and precompiler definitions)?

I'd say that since your build is so complex, a build script would be a better choice to handle all that complexity. You could write the script using MSBuild, NAnt, Rake or whatever you prefer. When you want to build some configuration, or all, you just call the script with the appropiate parameters.

My recommendation: Use the IronRuby-Albacore combo, it's really straightforward and you code your build script in Ruby, which is much more readable than XML. Get started here

One option is to create a Visual Studio macro and binding it to a either key or a menu item. Once the macro is invoked you can have it iterate through all of the solution platforms and build each one.

There is a dropdown box for the target platform which can be added to the toolbar ("Project Platform"). This eliminates the need to encode the platform in Project Configurations.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM