SQL71501: User has an unresolved reference to Login in Visual Studio 2012 Database Project

If you create application specific logins (which you should) then you are going to come across this error when trying to build your solution.

UPDATE: 15th May 2013 - Jim commented a fix for this - "I have resolved this, it's quite simple to add the logins. You have to select include 'Non-Application-scoped' object types in the options when you do a schema compare.  You can then just import the logins into your regular project, and the references are sorted."

Thanks to Jim.

Unlike vs2010, Vs2012 does not have a database server project type, only database project.  This is a bit of a missing link in Vs2012, as with 2010 you could simply create a server project, and reference the server project from your database project, ensuring that the reference to the server level login was valid. 

This has been raised as a bug on connect but no fix is available at the time of writing and having just recently installed vs2012 update 1 it may not be remedied for some time.  A simple workaround is to add another database project to your solution, and make its target database the master database.  When it imports the master database objects it will include the ‘unresovlved reference to Login’ that the build process was complaining about.

Guy Harwood

Read more posts by this author.

UK