views:

109

answers:

2

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?

+2  A: 

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

taylonr
A: 

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

http://stackoverflow.com/questions/721173/msbuild-task-configuration-property http://stackoverflow.com/questions/1137017/msbuild-specify-platform-for-build

For MSBuild tutorial, see MSBuild Tutorials

desigeek