Ok, there are a bunch of posts about this, but all different versions of the problem. I could not find a post with my specific (albeit, basic) version of the problem. First, these are the steps that I followed to create a database project in Visual Studio 2012 (shell) with SQL Server Data Tools (SSDT):
- Create new project, SQL-> database project
- Right click on project, choose "Compare Schema"
- Set source (SQL Server instance on a server)
- Set target (local database project - the current project)
- Run the "Schema Compare"
- Update the target
This gives me a populated database project of all the objects in SQL server database. However, upon building the project, I get 200+ errors of unresolved references:
X- contains an unresolved reference to an object. Either the object does not exist or the reference is ambiguous because it could refer to any of the following objects: X, Y, Z
AND
X- has an unresolved reference to object
Adding a database reference to Master cut the errors down to 127, and now it's more manageable, but this not resolved. It only affects 5 or 10 objects out of 100's. Here's some things to keep in mind:
Only one database is used in the SQL Server objects (views, etc.)
Only 2 part naming ie (dbo.Table as T)
The "Enable Extended Transact-SQL verification for common objects" option is not present in my version of VS 2012, this feature was removed by Microsoft, and is already turned off.
I ran the command line
sqlpackage.exeand created a dacpac of the database, this was then added as a database reference.
The database project will still not build. The errors only pertain to certain views and procedures. Has anyone had this problem?