“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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Kevin Kline

Career and Technical Advice for the IT Professional

TroubleshootingSQL

Explaining the bits and bytes of SQL Server and Azure

SQL Authority with Pinal Dave

SQL Server Performance Tuning Expert

Powershellshocked

A blog about PowerShell and general Windows sysadmin stuff

Simon Learning SQL Server

I'm trying to become "better" at SQL Server and data - here's how I'm doing it!

%d bloggers like this: