Project contains an invalid database reference


If you have multiple developers working in a SQL Server Database Project and not all developers have applied the latest update they may see the following compilation error message for the System Database references: master and msdb.

Project ‘[project_name].sqlproj’ contains an invalid database reference: ‘C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\SQLDB\Extensions\SqlServer\120\SqlSchemas\master.dacpac’.  You must update the reference so that it identifies a database project whose version of SQL Server matches the version on which your referencing database project is based or add server and database variables to make any references to this project a 4 part name.

Project ‘[project_name].sqlproj’ contains an invalid database reference: ‘C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\SQLDB\Extensions\SqlServer\120\SqlSchemas\msdb.dacpac’.  You must update the reference so that it identifies a database project whose version of SQL Server matches the version on which your referencing database project is based or add server and database variables to make any references to this project a 4 part name.

You will need to deploy the latest version of SQL Server Data Tools (SSDT) on all of the developers’ workstations that are working with the SQL Server Database Project so everyone has the same version/release of the schema dacpac files.

120-sqlschemas

SQL Server Schemas

After SSDT has been updated/installed you can see these files have been updated and your database project should compile without errors.

If you are unable to install the latest version of SSDT you can always remove the references and add them again but this time selecting the checkbox “Supress errors caused by unresolved references in the referenced project“.

snag-3759

Add Database Reference – Supress errors

 

If you’re curious where these files are located on your workstation, if you are using VS 2015 and targetting SQL Server 2014 you can find them here:

C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\SQLDB\Extensions\SqlServer\120\SQLSchemas

The exact location which is relevant to your environment and project will be displayed in the compile error as shown at the beginning of the post.

snag-3760

SQL Schemas – After September 2016 SSDT installed

 

About wesmacdonald

Wes MacDonald is a Visual Studio ALM MVP, PSD, MCT and a Principal Consultant for LIKE 10 INC., a SharePoint Server, Visual Studio and Team Foundation Server Consulting Firm providing premium support and guidance services.

No comments yet... Be the first to leave a reply!

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

%d bloggers like this: