MSBUILD Error MSB4025 in TeamCity build step for Visual Studio

Ace picture Ace · Apr 10, 2014 · Viewed 13.2k times · Source

When I run my TeamCity build with the only build step being of runner type Visual Studio (sln), I get the following error:

C:\TeamCity\buildAgent\work\4978ec6ee0ade5b4\Test\Code\Test.sln(2, 1): error MSB4025: The project file could not be loaded. Data at the root level is invalid. Line 2, position 1.

This is on a dedicated CI server running TeamCity Professional 8.1.1 (build 29939). There are several other successfully-running builds on this server.

The odd bit is that the same build runs successfully on TeamCity on my dev machine. I followed an answer to a similar question, and copied the specified folders across, but that didn't help.

I'm sure the project/solution file isn't invalid because in addition to the build running on my dev box, I have opened the solution in Visual Studio and built it there with no problems.

Any suggestions?

Answer

kennydust picture kennydust · Jun 12, 2014

I just fixed this.

Look inside the Test.sln file for Project or EndProject tags that aren't closed. For us, the EndProject was missing and it broke on teamcity, but no issues in Visual Studio.