I am using VS2010 and .NET 4.0.
I have two little projects A and B. A is a C++/CLI DLL Project, and B is a C# EXE project referencing A. Both must be compiled in x86, because A uses x86 native dll.
When I build B with VS2010 IDE, B compiles well. Next I try to build B with MSBuild with following command line
MSBuild B.csproj /property:Platform=x86;Configuration=Release
And it fails with following error.
"A.vcxproj" (default target) (16) -> (InvalidPlatformError target) -> C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.Cpp.InvalidPlatform.Targets(23,7): error MSB8007: The Platform for project 'A.vcxproj' is invalid. Platform='x86'. You may be seeing this message because you are trying to build a project without a solution file, and have specified a non-default Platform that doesn't exist for this project. [A.vcxproj]
It seems to happen because C++/CLI uses "Win32" as platform name, whereas C# uses "x86". So when I specify "x86", It fails to build A. If "Win32", fails to build B.
I have to use MSBuild because of auto building. Default platform for B is fixed to AnyCPU (and I cannot change it), so I cannot use default platform trick and must specify "x86" when building with MSBuild. How can I do this? Is there any way to change the platform name, or, the better way to use MSBuild? Can I do this without using default platform?