-->

“Model already has an element” errors (TSD04105) w

2019-06-25 08:10发布

问题:

I am using Visual Studio 2008 Database Project GDR2 to manage multiple databases and I am getting a number of errors related to synonyms.

Project-A has a reference to Project-B because Project-A has a number of synonyms to tables in Project-B. The full error I'm getting is "TSD04105: The model already has an element that has the same name dbo.[OBJECT]". This always points at the synonym.

The issue seems to be that the synonym on Project-A has the same name as the table on Project-B. Obviously I could rename all my synonyms so that they have different names than the tables, but this introduces a LOT of work on my part (there's over 140 synonyms so far).

Removing the reference to Project-B will get rid of that error, but instead all of my stored procedures in Project-A generate errors because it can't reference the tables in Project-B any more.

Is there a way to fix this problem short of renaming all the synonyms? What is the appropriate way to handle this situation in the Database Project?

回答1:

I had this issue between a 2008 server project and a database project and I solved it by using a literal Database Variable Value.

Referencing project properties -> References Tab -> Database Variable Value

I would say that you could also use a Database Variable Name/Value pair as well.