views:

59

answers:

2

I need to generate different assembly names depending on the platform target. For example, I have a console application "bob.exe". Instead of building for AnyCPU, I need to build explicitly for x86 and x64 and thus want "bob32.exe" and "bob64.exe". The Application tab in Visual Studio 2010 project options disables the Platform combobox. Build Events also don't allow options per platform so I can't rename it afterwards very easily.

Update: Manually editing the project file seems to work best, no extra files are part of the build and the pdbs have a matching name.

+2  A: 

You can add a Post-Built event to copy the executable using the $(PlatformName) macro.

You'll need to copy (not rename) or the debugger won't work.

SLaks
This is pretty close, but $(PlatformName) is "x86" or "x64" and I don't see an option to rename the platform. Ideally I would like "32" and "64". I guess I can add an extra two steps to blindly copy bobx86.exe to bob32.exe after each build.
Murray
You can go to Configuration Manager and rename the platforms.
SLaks
I'm unable to rename the platforms in the project, only the solution.
Murray
+2  A: 

The IDE cannot handle this, but msbuild.exe does. Edit the .csproj file with, say, Notepad. You'll see four PropertyGroups for the settings of x86/x64 and Debug/Release. The first one has an <AssemblyName> element. Copy and paste it into the other 3 groups. And rename their value.

Hans Passant