Press "Enter" to skip to content

“MSB4025: The project file could not be loaded. Data at the root level is invalid.” error when building SSDT project in TeamCity

I recently encountered this error when attempting to build a solution with a new SSDT project in TeamCity. The error occurred at the 01 – Build configuration “Visual Studio (sln)” step:

Data.sln(2,1): error MSB4025: The project file could not be loaded. Data at the root level is invalid. Line 2, position 1.

The error message didn’t tell me a great deal about the actual problem & since the solution was building & deploying fine in Visual Studio, I googled the error in relation to TeamCity. I found that it may have been a missing Project or EndProject tag in the solution. However, on opening Data.sln in a text editor, I found that there were no missing tags.

The next step in my investigation was to review the changes I had pushed which had caused the breaking build. I had just added a new test project to the solution so that the project list for Data.sln looked like:

  • Accounts (the main database project)
  • Accounts.Tests (an old test project that was being replaced piecemeal by Accounts_Tests)
  • Accounts_Tests (the new tSQLt test project)

I investigated further using msbuild locally to build the solution with OctoPack:

msbuild "D:\GitHub\Accounts\Data.sln" /t:Build /p:RunOctoPack=true

This provided a more useful error:

MSB5004: The solution file has two projects named "Accounts_Tests"

It seems that OctoPack interprets Accounts.Tests & Accounts_Tests as having the same name & threw an error as a result. To resolve, I renamed Accounts_Tests to Accounts_tSQLt. This resolved both the local OctoPack build issue & the TeamCity error.

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *