I have a number of database projects using tSQLt that build correctly in Visual Studio 2010. When I open them in Visual Studio 2012, I'm informed that the IDE has to make "functional changes" in order to use them.
Once I let the conversion go through, none of the database projects build successfully anymore. Instead, it seems like ever object in the tSQLt schema raises an error about sys.objects that looks like this:
{Path}.Database.Messages\Schema Objects\Schemas\tSQLt\
Programmability\Functions\Private_GetConstraintType.function.sql(6,10):
Error: SQL71501: Function: [tSQLt].[Private_GetConstraintType] has an
unresolved reference to object [sys].[objects].
The conversion doesn't appear to have changed the named scripts in any way. What's going on? (And how do I investigate a problem like this. It's pretty cryptic.)
tSQLt function [tSQLt].[Private_GetConstraintType] selects from sys.objects which is located in msdb system database.
You need to add database reference to msdb (or master) database to your Database Project in the Visual Studio 2012 (Data Tools).
To do this go to the Solution->Project->Reference->Add Database Reference (see screenshot below)

and add reference to the system database msdb. This should help.

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With