6

I am working in EF 6 and facing the following issue when I try run my project.

Schema specified is not valid. Errors:

Multiple types with the name 'TableName' exist in the EdmItemCollection in different namespaces. Convention based mapping requires unique names without regard to namespace in the EdmItemCollection.

I tried too much on StackOverFlow and google and found no solution. I am using visual studio 2012. I crated a single .edmx file for whole of my database. I searched the tableName throughout the project and there is single occurrence of table.

Please help me in this regard

2 Answers 2

8

Finally I figured out the solution of the problem. In my question above, I stated that I have only single edmx file in my project. It is true in one sense. But wrong in the other sense.

I am using git to manage my code. I created another edmx file in another project and used that project's reference in my main project.

Then I switched git branch with dll in .gitignore. Those dlls which were in .gitignore could not be replaced by git with the newly switched branch's dlls. So I had two references of edmx files in my project with fully built dlls.

Problem solved when I keenly checked my bin folder and removed the dll which was actually not belonging to the current git branch.

I hope it will help you. Comment here if some thing is not clear. Thanks

Sign up to request clarification or add additional context in comments.

1 Comment

Hi! I'm facing the same problem, hoping to solve the way you did.
1

I spend hours fixing it, tried publishing/deploying all the projects but no luck. So, finally found out that there was a dll that was referenced twice. But with slightly change in name but pretty much similar content. So, program wasn't sure which file to look at. I redeployed all the projects but still no luck. So, finally deleted all the files from server except webconfig and global asax. And the deployed the files again. Finally it worked.

1 Comment

Yup, looks like the same problem I faced

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.