Entity Framework - Already Defined

Echilon picture Echilon · Jul 24, 2011 · Viewed 28.2k times · Source

I have a problem with an EDMX file which I've never encountered before. Seemingly randomly when the site is running or I'm debugging, the EF will bomb out and complain that everything is re-defined. I have to restart the app pool and re-attach the debugger every time, then start again from where I left off, after which it works again until the next time it bombs out.

I've already recreated the EDMX with a different name, hence MyAppEntities*1*

The error is:

Error: Schema specified is not valid. Errors: App_Code.Fck.csdl(3,4) : 
error 0019: The EntityContainer name must be unique. An EntityContainer with the name 'MyAppEntities1' is already defined. App_Code.Fck.csdl(69,4) : 
error 0019: Each type name in a schema must be unique. Type name 'FckModel.AdSection' was already defined. App_Code.Fck.csdl(79,4) : 
error 0019: Each type name in a schema must be unique. Type name 'FckModel.AgeRating' was already defined. App_Code.Fck.csdl(89,4) : 
error 0019: Each type name in a schema must be unique. Type name 'FckModel.Comment' was already defined. App_Code.Fck.csdl(101,4) : 
error 0019: Each type name in a schema must be unique. Type name 'FckModel.ContentImage' was already defined. App_Code.Fck.csdl(115,4) : 
error 0019: Each type name in a schema must be unique. Type name 'FckModel.ContentVideo' was already defined. App_Code.Fck.csdl(126,4) : 
error 0019: Each type name in a schema must be unique. Type name 'FckModel.FeaturePlan' was already defined. App_Code.Fck.csdl(142,4) : 
error 0019: Each type name in a schema must be unique. Type name 'FckModel.Flick' was already defined. App_Code.Fck.csdl(165,4) : 
error 0019: Each type name in a schema must be unique. Type name 'FckModel.Gallery' was already defined. App_Code.Fck.csdl(184,4) : 
error 0019: Each type name in a schema must be unique. Type name 'FckModel.Genre' was already defined. App_Code.Fck.csdl(197,4) : 
error 0019: Each type name in a schema must be unique. Type name 'FckModel.Like' was already defined. App_Code.Fck.csdl(208,4) : 
error 0019: Each type name in a schema must be unique. Type name 'FckModel.Meta' was already defined. App_Code.Fck.csdl(216,4) : 
error 0019: Each type name in a schema must be unique. Type name 'FckModel.Payment' was already defined. App_Code.Fck.csdl(236,4) : 
error 0019: Each type name in a schema must be unique. Type name 'FckModel.StatusUpdate' was already defined. App_Code.Fck.csdl(246,4) : 
error 0019: Each type name in a schema must be unique. Type name 'FckModel.UserProfile' was already defined. App_Code.Fck.csdl(277,4) : 
error 0019: Each type name in a schema must be unique. Type name 'FckModel.FK_FeaturePlans_AdSections' was already defined. App_Code.Fck.csdl(289,4) : 
error 0019: Each type name in a schema must be unique. Type name 'FckModel.FK_Flicks_AgeRatings' was already defined. App_Code.Fck.csdl(301,4) : 
error 0019: Each type name in a schema must be unique. Type name 'FckModel.FK_Comments_Users' was already defined. App_Code.Fck.csdl(313,4) : 
error 0019: Each type name in a schema must be unique. Type name 'FckModel.FK_Payments_FeaturePlans' was already defined. App_Code.Fck.csdl(325,4) : 
error 0019: Each type name in a schema must be unique. Type name 'FckModel.FK_Flicks_Users' was already defined. App_Code.Fck.csdl(337,4) : 
error 0019: Each type name in a schema must be unique. Type name 'FckModel.FK_Genres_Genres' was already defined. App_Code.Fck.csdl(349,4) : 
error 0019: Each type name in a schema must be unique. Type name 'FckModel.FK_Likes_Users' was already defined. App_Code.Fck.csdl(361,4) : 
error 0019: Each type name in a schema must be unique. Type name 'FckModel.FK_Payments_Users' was already defined. App_Code.Fck.csdl(373,4) : 
error 0019: Each type name in a schema must be unique. Type name 'FckModel.FK_StatusUpdates_Users' was already defined. App_Code.Fck.csdl(385,4) : 
error 0019: Each type name in a schema must be unique. Type name 'FckModel.FlickGenres' was already defined. App_Code.Fck.csdl(389,4) : 
error 0019: Each type name in a schema must be unique. Type name 'FckModel.User' was already defined. App_Code.Fck.csdl(401,4) : 
error 0019: Each type name in a schema must be unique. Type name 'FckModel.FK_Users_be_Users' was already defined. App_Code.Fck.csdl(413,4) : 
error 0019: Each type name in a schema must be unique. Type name 'FckModel.ContentImageSet' was already defined. App_Code.Fck.csdl(426,4) : 
error 0019: Each type name in a schema must be unique. Type name 'FckModel.FK_ContentImages_ContentImageSets' was already defined.

Answer

Damith picture Damith · Jul 24, 2011

You may be changed the assembly name of the project that contained the model.

The reference to the original assembly was still in the client application.

ASP.net Web Application : - Manually delete dll and pdb files.

ASP.net Web Site: - Perform an IIS reset then flush out the asp.net temporary files in the folder C:\windows\microsoft.net\your framework version\temp asp.net files\