"someSolutionFile.sln: error MSB4025: The project file could not be loaded. Data at the root level is invalid. Line 2, position 1"
错误的MSBuild调用非常简单:
<MSBuild
Projects="someSolutionFile.sln"
Targets="someProject.csproj"
Properties="..."
BuildInParallel="false"
/>
开发机和构建服务器都使用完全相同的msbuild版本:
Microsoft (R) Build Engine version 15.8.169+g1ccb72aefa for .NET Framework
为什么只有构建服务器出错而不是开发机器出错?
答案 0 :(得分:1)
结果是.sln上的合并之一意外删除了[endproject]节。错误消息确实对误解产生了误导:
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8DCAA708-E9BE-4C30-B267-F60B2F36C031}"
ProjectSection(SolutionItems) = preProject
Performance1.psess = Performance1.psess
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "[some project 1]", "[some project 1].csproj", "{2CD27468-B1D4-4380-BF06-78CCDDCE53C2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "[some project 2]", "[some project 2].csproj", "{0DB85F19-4E9E-417D-828D-D44566554B5F}"
EndProject <--- this was missing
如果您遇到此类问题,Visual Studio不会以任何方式抱怨。要简单地重新标准化.sln文件:
.sln文件现在应该是正常的了。您可以将其提交到分支机构。