开发者

one project with multiple build configurations in VS2010?

开发者 https://www.devze.com 2023-01-10 16:24 出处:网络
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 p开发者_开发知

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 p开发者_开发知识库latform 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?


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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号