System.Data.MetadataException: Unable to load the specified metadata resource

My connection strings are as follows:

<add name="RollCallDBEntities" connectionString="metadata=res://System.Engine/RollcallNS.csdl|res://System.Engine/RollcallNS.ssdl|res://System.Engine/RollcallNS.msl;provider=Devart.Data.Oracle;provider connection string=&quot;User Id=user;Password=password;Server=;Direct=True;Sid=ORCL&quot;" providerName="System.Data.EntityClient" />

my code are as follows:

using (var db= new RollCallDBEntities()) //ok
   var query = db.TBL_ROLLCALL.ToList(); //Unable to load the specified metadata resource.

my assembly:


Anyone have any ideas?

these links did not soled my problem: MetadataException: Unable to load the specified metadata resource entity framework Unable to load the specified metadata resource Entity Framework: Unable to load the specified metadata resource Unable to load the specified metadata resource


Refer to .

If this doesn't help, please specify:

  • are you working with ADO.NET Entity Data Model (.edmx) or Devart Entity Model (.edml)?
  • the value of your model file's Build Action property
  • the value of the Metadata Artifact Processing property of your model
  • the build number ( of your dotConnect for Oracle
  • the version of your Visual Studio
  • follow Pawel's advice to check if resources were embedded in the assembly

I was getting an exception like this. The problem was that I renamed my .edmx file and forgot to change the name in EF Web.config file's connection string:


The easiest solution that resolved this for me was to remove the obj folder which sit at the same level as the bin folder and re-run the application, my god it took way longer than it needed

I used EntityFramework 6.0 in one solution which included multiple projects such as WebSite level project, DataAccess level project. In my solution, the migrations should be happened in DataAccess level project.

When I run Add-Migration command in Package Manager Console, raised "Unable to load the specified metadata resource".

Finally, I found I set the WebSite level project as "Startup" project and this trigger above exception. It seems system will auto checking the connection string settings in the StartUp project first. And my data connection string set in WebSite level project is

"metadata=res:///ApplicationEntities.csdl|res:///ApplicationEntities.ssdl|res://*/ApplicationEntities.msl;provider=System.Data.SqlClient;provider connection string="data source=.;initial catalog=YourDatabaseName;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework""

which is not correct for code first.

The correct connection string should be:

"Data Source=.;Initial Catalog=YourDatabaseName;Integrated Security=True"

Conclusion, always check the "connectionStrings" section in web.config in the "StartUp" project of solution first.

If you are unsure of what the correct path is for your Metadata files, you can find out by compiling your application, then opening the DLL using JetBrains' dotPeek and looking in the Resources folder to find the .csdl etc. file.

I also encountered this problem and it was because I forgot to reference the project that contained the EDMX file.

I've had a similar product with devart mysqlconnect - maybe this might help.

I have a project called EFModels which contains the .edml file and is referenced by other projects.

I noticed that the Release version of a project that referenced EFModels contains the EFModels.dll but it was much smaller in size (127kb vs 437kb) than the Debug version of EfModels.dll. Moving the EFModels.dll from the debug version into the Release version solved the issue for me as for some reason the Release version did not embed the ssdl etc.

I also encountered this problem and it was because I was going from Entity Framework Model First to Entity Framework Code First, and had forgotten to change the EDMX connectionstring to a 'regular' connection string.

This answer is specific for Devart Entity developer edml file.

When I upgraded the csproj format(Visual studio 2017 with simple format) I got this error. The csproj has a feature where you don't need to include each file instead it includes all the relevant files under the folder by default so the entity framework files are treated same way as cs files so those are not embedded into the assembly by default.

I need to manually change the build action of my edml file to 'DevartEntityDeploy' which resolved my problem.

I also encountered this problem becaue I was the missing EntityFramework config section in the app.config.

I had this: <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />

But not this: <entityFramework> <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework"> <parameters> <parameter value="mssqllocaldb"/> </parameters> </defaultConnectionFactory> <providers> <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/> </providers> </entityFramework>

Need Your Help

Android dial a phone number programmatically

android android-intent

How do I dial a number programmatically from the Android application? I don't want to make a call, which I know I can do by making an intent: new Intent(Intent.ACTION_CALL), I just want to take the...

Get attribute values from matching XML nodes using XPath query

c# xml extension-methods xpath xpathnavigator

This doesn't seem like it should be difficult, but I'm stuck currently. I'm trying to get the attribute values for a particular attribute from nodes that match a given XPath query string. Here's ...