Reputation: 4206
"someSolutionFile.sln: error MSB4025: The project file could not be loaded. Data at the root level is invalid. Line 2, position 1"
The MSBuild invocation which errors out is really simple:
<MSBuild
Projects="someSolutionFile.sln"
Targets="someProject.csproj"
Properties="..."
BuildInParallel="false"
/>
Both dev-machines and the build server use the exactly same msbuild version:
Microsoft (R) Build Engine version 15.8.169+g1ccb72aefa for .NET Framework
Why could it be that only the build server errors out but not the dev-machines?
Upvotes: 0
Views: 142
Reputation: 4206
Turns out that one of the merges on the .sln accidentally removed an [endproject] section. The error message was really misleading as to what was amiss:
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
If you have such problems Visual Studio somehow won't complain. To re-normalize the .sln file simply:
The .sln file should be sane now. You may commit it to your branches.
Upvotes: 1