AZ_ELIE

I have 2 database projects.

DBP_A

DBP_B

In DBP_A I am referencing database B and also database C which I did not create a DB project for yet in my solution.

To get rid of the warning referencing database B I created reference to DBP_B and assinged a variable. [$(B)] to replace B. I was left with the warning referencing database C.

So I went to DBP_A and added a new reference. This time I referenced the meta file for the DBP_B (DBP_B.dbmeta)

and assinged [$(C)] to replace C.

I don't think I should be allowed to do that. I think if I already created a reference to a database project whether straight or through the meta file I should not be allowed to reference it anymore.

Note: I was not able to have more than one reference to the meta file or straight to the db project.

Thanks,
Elie



Re: Visual Studio Team System - Database Professionals Referencing same database project and dbmeta file

StevenPo - MSFT

Elie -

I believe that the team explicitly allowed that scenario. The .dbmeta file is essentially a snapshot of your database project schema at a point in time (and thus could be different than your database project). If my memory is correct, we allowed this so you can address the scenario where you have multiple instances of the same database schema deployed to different database. If you have multiple copies of the .dbmeta file, with different paths, you can have a reference to each. This supports scenarios such as when you have a single database that has references to multiple instances of a second schema.

If you have not already familiarized yourself with the background information about cross-database references, you might want to take a look at: http://msdn2.microsoft.com/en-us/library/bb386242(VS.80).aspx (Overview).

hope this helps,






Re: Visual Studio Team System - Database Professionals Referencing same database project and dbmeta file

Gert Drapers - MSFT

You can have the same dbmeta file contribute multiple times since they contribute to different namespaces, which are defined by the combination of server and database variable name.

Not that this is very efficient, but it can be done.

This allows you to reference the same schema via 3 part names and 4 part names for example, which is something that can not be represented by a single reference.

-GertD





Re: Visual Studio Team System - Database Professionals Referencing same database project and dbmeta file

AZ_ELIE

Thanks.

Did you mean very unefficient

What I am trying to do is this:

I have one database in my solution. DB_A this database has couple store procedures that call DB_B and DB_C and DB_D. I don't have B,C and D databases in my solution.

What I want to do is reference their names with variables at build time (In the build script) and get rid of the warnings.

"You have the same dbmeta file contribute multiple times" Is this from different paths. Because when I try to reference the same dbmeta from the same location the application warns me that it is already referenced.

Thanks again,

Elie





Re: Visual Studio Team System - Database Professionals Referencing same database project and dbmeta file

StevenPo - MSFT

Elie -

Do B, C, and D all share the same schema If so, then yes, you need to have a copy of the .dbmeta file (on a unique path) for each referenced database. If B, C, and D each have different schemas, then you'd want to create a .dbmeta file for each with the appropriate schema.

glad to help (or try to Smile),






Re: Visual Studio Team System - Database Professionals Referencing same database project and dbmeta file

AZ_ELIE

Thanks.