MetadataException: The given metadata resource could not be loaded.

.net c# entity-framework


I suddenly kept receiving aMetadataException while launching my generatedObjectContext class. I've tried producing a new model (edmx-file) from the underlying database with no effect, even though the connection string in App.Config seems to be accurate and hasn't changed since it last worked.

Anyone have a suggestion?

Additional information: I have not attempted to embed the EDMX in the assembly, modified any attributes, or renamed any output assemblies. I just had to wait 10 hours between leaving work and returning. After then, it ceased to function.

I attempted to recreate the EDMX. I attempted to recreate the project. I even tried starting again with the database. Absolutely no luck.

2/17/2013 8:50:58 AM

Accepted Answer

This indicates that the EDMX cannot be loaded by the program. There are several factors that might contribute to this.

  • It's possible that you modified the model's MetadataArtifactProcessing property to Copy to Output Directory.
  • Potentially incorrect connection string. Even when you claim not to have altered anything, if you have made other changes (like the name of an assembly, for example), it may still be inaccurate.
  • The EDMX may be embedded in the assembly using a post-compile job that is no longer functional for whatever reason.

In summary, your inquiry doesn't really provide enough information for a proper response, but maybe these suggestions will put you on the right path.

Update: I have a blog article with more detailed troubleshooting instructions written.

1/16/2018 1:48:38 PM

Popular Answer

This little adjustment helps with the issue.

I have a project with three solutions.


alter to


Related Questions


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow