Error 1 SQL03006: User: [ ] has an unresolved reference to Login [ ]

I am running into an issue when I import a db into a SQL Database project which indicates that “Error 1 SQL03006: User: [x] has an unresolved reference to Login [x]”. After doing some research I found out that to be able to execute the Create User command the x.user.sql file contains you need to have a SQL Server object to handle that dependency.

One way to resolve this issue is to simply not have any users and create a post deployment tasks to add the users (assuming their logins exist) or do that as a manual task. You can turn off schema checking on (Tools > Options > Database Tools > Schema Compare > SQL Server > ‘Object Type’ tab) for users, etc.

Another way which is a bit more complex includes adding a Server project so that the referenced LOGIN object exists in your solution and can be controlled from VS. The problem with this as you could expect is that having a Server project involves VS managing several Server objects and that might not work in your environment (Think master db, etc).

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.