x64 build: error MSB8013: This project doesn't contain the Configuration and Platform combination of Debug|Win32

user1825216 picture user1825216 · Oct 15, 2015 · Viewed 18.6k times · Source

I'm trying to get a pure x64 build running for a complex build with many solutions (some for CI, some for devs) and hundreds of project and have run into "error MSB8013: This project doesn't contain the Configuration and Platform combination of Debug|Win32"

I've reduced it to a simple configuration:

  • Solution A contains Project X & Project Y. Project X has a project reference to Project Y.
  • Solution B contains also contains Project X.

None of the projects or solutions contain a Win32 platform - it's been deleted.

When I build solution B (as x64), I receive

error MSB8013: This project doesn't contain the Configuration and Platform combination of Debug|Win32

The error message sometimes contains additional information:

This error may also appear if some other project is trying to follow a project-to-project reference to this project, this project has been unloaded or is not included in the solution, and the referencing project does not build using the same or an equivalent Configuration or Platform.

The problem is the referencing project does "build using the same or an equivalent Configuration or Platform."

Looking at the msbuild diagnostic, project Y is being built because project X contains a project reference to it. But the configuration and platform properties are being deleted just before project Y is built:

1>Task "MSBuild" (TaskId:28)
1>  Removing Properties: (TaskId:28)
1>    Configuration (TaskId:28)
1>    Platform (TaskId:28)

As a result Microsoft.Cpp.Default.props kicks in and sets these to Debug|Win32:

1>Task "Message" (TaskId:11)
1>  Configuration=Debug (TaskId:11)
1>Done executing task "Message". (TaskId:11)
1>Task "Message" (TaskId:12)
1>  Platform=Win32 (TaskId:12)
1>Done executing task "Message". (TaskId:12)

How can I prevent this and make msbuild pass the chosen configuration & platform?

(I understand the ultimate solution to use NuGet to manage package dependencies, but that isn't feasible in the short term)

Answer

Zord picture Zord · May 27, 2016

I could resolve a similar issue by including all referenced projects into the solution - in this case including Project Y into solution B.