I’ve got this error while refactoring a project that contains an Entity Data Model. I’ve tried to google and find good solution. Here it is:
BAModel.csdl(3,4) : error 0019: The EntityContainer name must be unique. An EntityContainer with the name 'BAEntities' is already defined.
BAModel.csdl(118,4) : error 0019: Each type name in a schema must be unique. Type name 'BAModel.Activity' was already defined.
One reason you might see this is if you have two models in a project that have the same schema. Maybe you decided to start your model over from scratch.
But in this scenario, that was not the case. It turned out that the problem was because I had changed the assembly name of the project that contained the model. The reference to the original assembly was still in the client application's BIN folder along with the new one.
Entity Framework was attempting to load the metadata files from both assemblies and detected the conflict.
Cleaning the project didn't fix the problem. The leftover assembly was still there.. I had to delete the dll and pdb file manually.
I first came across this problem and fixed it last week. But it happened again with another solution today and took me a while to remember the cause and the fix. The older I get, the more I need to rely on my blog for retaining that which my memory seems to be incapable of storing away.