TSD03006: User: [x] has an unresolved reference to Login [y]
I just downloaded and installed the GDR RC and am attempting to convert a previous VS 2005 database project to VS 2008 database project. The conversion went fine, but now when I try to deploy to my local instance of SQL 2005 I get the following error, which I do not get in VS 2005:
TSD03006: User: [x] has an unresolved reference to Login [y].
The login does exist on the sql instance. I saw in a previous post that case sensitivity could be an issue with this, but the case matches. This is a SQL login, not a windows login.
What should I be looking at to resolve this problem? This is the last thing that is holding my team back from fully migrating over to VS 2008 and I really want to get this resolved quickly. Thanks!
Answers
- Logins are server level objects and aren't represented in the database project.
To reference server level objects in your database,- Add a new server project to your solution
- Add the Login to the server project
- In your database project, add a database reference for the server project
- Build the solution
Andrew
- Marked As Answer byRobertSCook Wednesday, November 05, 2008 7:17 PM
- Proposed As Answer byAndrew Campbell - MSFTMSFTWednesday, November 05, 2008 5:15 PM
All Replies
- Logins are server level objects and aren't represented in the database project.
To reference server level objects in your database,- Add a new server project to your solution
- Add the Login to the server project
- In your database project, add a database reference for the server project
- Build the solution
Andrew
- Marked As Answer byRobertSCook Wednesday, November 05, 2008 7:17 PM
- Proposed As Answer byAndrew Campbell - MSFTMSFTWednesday, November 05, 2008 5:15 PM
- Is this something new in the VS 2008 version of the DB project? I didn't have to do this with the VS 2005 version. Just to clarify, the error is happening on the user object, not the login object. The user object is schema dependant and is tied to a login, which is server dependant. The script that is erroring out is in the Schema Objects -> Security -> Users folder of the project.
Am I misunderstanding something? (entirely possible) - In VS 2008 SP1 and prior, you would have had that login local to your Design-time Validation Database server. That is the only reason your User that is mapped to that login wasn't producing an error.
In GDR and beyond, there is no dependency on local Sql Server instances. This is why you now have to create a server project to represent the server objects your database is dependent on.
At deploy time, server projects validate that the required server objects exist (this is configurable in the deployment settings for the server project). If they don't then deployment fails and the database will not get deployed either.
In the case of your example, if the login in question doesn't exist on the target server for deployment of your database, deploy will stop when it can't find the login and you won't get a partial deploy of the database project.
So, in short, yes, this is something new. :)
Andrew - That did it. Thanks!
- How do you Add the Login to the server project (step2)?
Thanks,
Irfan You can add logins using the following steps
1) Open DatabaseSchemaView (It is under View menu)
2) Right click on the root element and choose Add. It will give a list of elements valid for the server project. You can choose login from there.


