one project with multiple build configurations in VS2010?

若如初见. 提交于 2020-01-14 10:34:08

问题


I have a c# windows application project. I want to build two .exe files, one is run as 64bit on 64 bit OS (by platform targeting 'Any CPU'), the other is run as 32 bit on 64 bit OS (by platform targeting x86).

Currently, I should change my build configuration whenever i need the other configuration, and rename the compiled file to distinguish between 32 and 64.

Is there an easier way to manage multiple configurations?


回答1:


Create a 32 bit build and 64 bit build. This will allow you to have them put in different folders.

Right click on the solution, choose "Configuration Manager" In the Active Solution Configuration choose "new" Call it 32-Bit Build Pick the 32 bit option in the CPU dropdown.

Repeat and name it 64-Bit build.

Now when you do a build it will go to C:\Development\ProjectName\Bin\32-Bit Build\programname.exe or similarly for 64 bit




回答2:


You can use a batch file to build the project. The file will use MSBuild and pass the target platform as a parameter. The property attribute will look like:

Properties="Configuration=Debug;Platform=Any CPU"

Properties="Configuration=Debug;Platform=x86"

Take a look at a few samples

MSBuild task configuration property MSBuild: Problems specifying platform for child builds

For MSBuild tutorial, see MSBuild Tutorials



来源:https://stackoverflow.com/questions/3442435/one-project-with-multiple-build-configurations-in-vs2010

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!