Tuesday 10 March 2009

What I learned today with... Visual Studio Team System Database Edition GDR

You cannot add multiple Server Projects as Database References in a Database Project

Apparently it balks at this.

I was trying to separate logins into a Server Project and the users in the Database Project. Seemed logical to me. Except I was going about things the wrong way.

What I missed was a very important point that was staring me in the face whenever I was adding a database reference.

Screenshot

Maybe I should be referencing mainly other Database Projects.

I had a second database that my main database was going to be referencing. For some reason I got it into my head that referencing a Server Project was the way to go. But apparently Database Projects only like referencing one Server Project and I was already doing that to bring in the Logins and other Server settings. I had to create a Database Project for the second Database.

Finally, by adding a Database Project for the referenced database I am able to build and deploy my main database.

Of course I did have a reason for not wanting to create a Database Project for the second database. That reason being the second database is actually a common database that is used across multiple applications and their corresponding databases. But I didn't want to tie the Database Project to a single solution.

So how do I organise Database Projects that will span multiple solutions?

The only solution I have is to create a special solution just for the common database that only includes the corresponding Server and Database Projects for that database. Next I add those two projects as "existing" projects into the solution that will reference that database (typically via some view for example.)

It seems like a cluggy solution but it is all I have at this moment.