0

I have a solution which contains two C++ and two C# projects. For the solution I have a Win32 configuration, which has the two C++ files as Win32 and the two C# files as AnyCPU. The x64 solution has C++ as x64 and C# as AnyCPU.

For the Win32 solution, the C++ files build in the /x86/Release/ folder, and I've set the C# files to output to the same folder. However, because it's set to AnyCPU, the x64 solution also has C# output to the /x84/Release/ folder.

I was hoping there would be some kind of macro in VS2012 that would allow me to select the solution's configuration so that I could set the output to $(SolnConfig)/Release, but there doesn't seem to be anything of the sort.

Is there any way I could (relatively) directly set the output for AnyCPU to x86 and x64 directories for respective solutions?

Michael C
  • 33
  • 2
  • 4

2 Answers2

0

You can create a custom config and define individual output directories per project under that config. Have a look here for details on how to set it up.

You can then make a batch file that will place bins according to some custom logic like so :

set msBuildExe=%WINDIR%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe

set configName=%1

set pluginReportsDir=..\..\..\..\Wcf\Plugins\PluginReports

echo ---
echo Backup common PluginReports reports
rem Since this is a post build event, the Common PluginReports is already built
echo ---------------------------
robocopy %pluginReportsDir%\bin\%configName%\ %pluginReportsDir%\bin\ PluginReports.dll PluginReports.pdb

echo ---
echo PluginReports for Site 3
echo ---------------------------
call %msBuildExe% %pluginReportsDir%\PluginReports.csproj /p:Configuration=%configName%Plugins_Site3 /t:Rebuild /noconsolelogger
move /y %pluginReportsDir%\bin\%configName%\PluginReports.dll %pluginReportsDir%\bin\PluginReports_Site3.dll
move /y %pluginReportsDir%\bin\%configName%\PluginReports.pdb %pluginReportsDir%\bin\PluginReports_Site3.pdb

Specify the batch file as a post build event and it will copy the files over. It can also perform the over builds if needs be.

Alex
  • 1,110
  • 8
  • 15
0

Looks like there are three platform settings: Solution Platform, Project Platform, and Platform Target. I was trying to set AnyCPU from the Project Platform level, which caused the mix-up for having the same output directory for Win32 and x64 in the Solution Platform level.

Answer: set solution platform to Win32 and project platform to x86 from configuration manager, and set Platform Target for the C# files to AnyCPU from the project's properties. Repeat for x64.

Michael C
  • 33
  • 2
  • 4