MSBuild 在构建解决方案时是否将项目解析为项目引用?

Does MSBuild resolve project to project references when building a solution?

MSDN 文档Visual Studio Integration (MSBuild)状态:

Building Solutions

Within Visual Studio, the solution file and project build ordering are controlled by Visual Studio itself. When building a solution with msbuild.exe on the command line, MSBuild parses the solution file and orders the project builds. In both cases the projects are built individually in dependency order, and project to project references are not traversed. In contrast, when individual projects are built with msbuild.exe, project to project references are traversed.

在我的 Visual Studio 2010 中,当从命令行使用 MSBuild 构建 .sln 文件时,项目到项目的引用都是 所有 构建的,无论是否它们出现在溶液中。

我在这里错过了什么?或者文档完全错误?

你可以通过运行 msbuild Solution.sln /t:ProjectName /p:BuildProjectReferences=false 忽略项目到项目引用的构建这个解释msdn中的句子。

你是正确的,msbuild.exe 将整理所有项目参考,无论它们是否是解决方案的一部分,而不是在 Visual Studio 2010/2012/2013/2015(可能更晚)内构建版本),如果引用的项目不是解决方案的一部分或事先构建,您将在其中构建失败。

简而言之,是的,文档似乎有点偏离。