c++ - x64 构建 : error MSB8013: This project doesn't contain the Configuration and Platform combination of Debug|Win32

标签 c++ visual-studio-2010 msbuild vcxproj

我正在尝试为具有许多解决方案(一些用于 CI,一些用于开发人员)和数百个项目的复杂构建运行纯 x64 构建,并遇到“错误 MSB8013:该项目不包含配置和 Debug|Win32 的平台组合”

我已将其简化为一个简单的配置:

  • 解决方案 A 包含项目 X 和项目 Y。项目 X 有一个项目 引用 项目 Y。
  • 解决方案 B 包含也包含项目 X。

所有项目或解决方案都不包含 Win32 平台 - 它已被删除。

当我构建解决方案 B(作为 x64)时,我收到

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

错误信息有时包含额外的信息:

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.

问题是引用项目确实“使用相同或等效的配置或平台构建。”

查看 msbuild 诊断,正在构建项目 Y,因为项目 X 包含对它的项目引用。但是在构建项目 Y 之前,配置和平台属性被删除了:

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

因此 Microsoft.Cpp.Default.props 启动并将它们设置为 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)

我怎样才能防止这种情况发生并使 msbuild 通过所选的配置和平台?

(我理解使用 NuGet 管理包依赖的最终解决方案,但短期内不可行)

最佳答案

我可以通过将所有引用的项目包含到解决方案中来解决类似的问题 - 在本例中,将项目 Y 包含到解决方案 B 中。

关于c++ - x64 构建 : error MSB8013: This project doesn't contain the Configuration and Platform combination of Debug|Win32,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33156131/

相关文章:

c++ - 最容易使用连接器/接口(interface)来使用 C++ 的 MySQL/其他数据库

msbuild - 使用 MSBuild/Web 部署项目启动程序而不等待它

c++ - 使用圆/C++中的正方形的边长来计算圆的面积

c# - 在一个解决方案中部署多个 Web 应用程序的最简单方法是什么?

c++ - 关于结构选择的模板错误

visual-studio-2010 - 更改 VS 2010 默认皮肤

c# - 无法构建带有 project.json 的 .NET 项目

msbuild - 如何在 MSBuild 脚本中使用自定义变量?

c++ - 在 Excel 自动化中使用非本地化公式

c++ - 打印 std::vector 的平均值