VS 2010 build database project receive SQL04151

7.2k Views Asked by At

I just started working with the Visual Studio 2010 Premium database project. I must say it does indeed rock. One thing I can't figure out is how to avoid the SQL04151 warning

Procedure: [dbo].[MyProc] has an unresolved reference to object [MyDatabase].[dbo].[MyItem].

Did I miss a simple step somewhere? All I can find online involves tempdb.

4

There are 4 best solutions below

1
On

In your [dbo].[MyProc] procedure you reference [MyDatabase].[dbo].[MyItem] which is probably not part of your DB project. Even though the object exists in the DB, it is not known to Visual Studio during compilation and thus yields an error.

Normally you should have the entire DB-schema in the DB-project. Otherwise I think there is something called "partial DB projects" that you can look into.

2
On

I need to substitute [MyDatabase].[dbo].[MyTable] with [$(DatabaseName)].[dbo].[MyTable]. This cleared up the warnings.

Thanks for your help.

2
On
0
On

Check you have set Build Action to Build on Properties pane for the specified object..