VS DBPro: Error TSD04105: The model already has an element that has the same name…

We use VS DBPRO a.k.a Data Dude for database development and deployment. It has great features like refactoring code from your existing database, data compare, schema compare, data generation & database unit testing.

But since it is not widely adopted, you have less resources available in the NET to help you out when in trouble. Recently we were in the same situation. We have been using DBPro for more than a year for our development and deployment. Few days back , when we tried to build a project, we got an error like

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v9.0\TeamData\Microsoft.Data.Schema.SqlTasks.targets(58,5)Error TSD04105: The model already has an element that has the same name #temp_DetailResult.AccountID.

Since the error did not say which file was having error, I took the temp. table “#temp_DetailResult” and searched in my project. Fortunately it was used in only one stored procedure. I verified the stored procedure for any errors but everything was fine. For testing purpose I excluded the stored procedure from my build and did rebuild of the project. But it failed again with the same error. Even though the stored procedure was removed from the project, seems like it was referring to it.

Googling led me to this thread which says this was an issue with the product and the resolution is to delete the .dbmdl file and reload the project.

I followed the steps and rebuilt the project. This time it erred with the same error but with another temp. table. Searched for the temp. table in the project and to my surprise , found that the stored procedure which was using this temp. table was called from two places ,once from Stored Procedure and again from Post Deployment script 😦

DB Pro was correct, the element was declared two times, which is wrong. Only issue was that DB Pro was not straight forward which took some of my time 🙂


About Suresh Kumar D

Hardcore SQL Developer and aspiring Database Architect.
This entry was posted in VS DBPRO. Bookmark the permalink.

One Response to VS DBPro: Error TSD04105: The model already has an element that has the same name…

  1. In my case, code that was commented out (using /* … */) contained the second declaration. Obviously that code was analyzed as well. Thanks for your post, it helped me solve my problem.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s