[.net] entity framework Unable to load the specified metadata resource

Possible Duplicate:
MetadataException: Unable to load the specified metadata resource

I hope someone can help with this. i have tried following other posts on here and dozens on other sites but i can get this working.

the entity framework was all working, then the next day just started giving me the error: Unable to load the specified metadata resource. on the constructor of the entities class.

I have checked the connection strings, deleted and re added everything but i still cant get this working.

my model namespace is WraithNath.co.uk.Models

the metadata artificat is embed in assembly

my connection strings are as follows:

<add name="ConnectionString" connectionString="Data Source=.\SQL2008;AttachDbFilename=|DataDirectory|\WraithNath.co.uk.mdf;Integrated Security=True;" providerName="System.Data.SqlClient" />
   <add name="Entities" connectionString="metadata=res://*/Models.WraithNath.co.uk.csdl|res://*/Models.WraithNath.co.uk.ssdl|res://*/Models.WraithNath.co.uk.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=.\SQL2008;AttachDbFilename=|DataDirectory|\WraithNath.co.uk.mdf;Integrated Security=True;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />

I cant find the 3 files i need in the assembly when looking at it in Reflector.

Is there a step by step guide to sort this out? i have already tried every link on the first 3 pages of google for search results 'entity framework Unable to load the specified metadata resource'.

This question is related to .net entity-framework

The answer is


Craig Stuntz has written an extensive (in my opinion) blog post on troubleshooting this exact error message, I personally would start there.

The following res: (resource) references need to point to your model.

<add name="Entities" connectionString="metadata=
    res://*/Models.WraithNath.co.uk.csdl|
    res://*/Models.WraithNath.co.uk.ssdl|
    res://*/Models.WraithNath.co.uk.msl;

Make sure each one has the name of your .edmx file after the "*/", with the "edmx" changed to the extension for that res (.csdl, .ssdl, or .msl).

It also may help to specify the assembly rather than using "//*/".

Worst case, you can check everything (a bit slower but should always find the resource) by using

<add name="Entities" connectionString="metadata=
        res://*/;provider= <!-- ... -->

Examples related to .net

You must add a reference to assembly 'netstandard, Version=2.0.0.0 How to use Bootstrap 4 in ASP.NET Core No authenticationScheme was specified, and there was no DefaultChallengeScheme found with default authentification and custom authorization .net Core 2.0 - Package was restored using .NetFramework 4.6.1 instead of target framework .netCore 2.0. The package may not be fully compatible Update .NET web service to use TLS 1.2 EF Core add-migration Build Failed What is the difference between .NET Core and .NET Standard Class Library project types? Visual Studio 2017 - Could not load file or assembly 'System.Runtime, Version=4.1.0.0' or one of its dependencies Nuget connection attempt failed "Unable to load the service index for source" Token based authentication in Web API without any user interface

Examples related to entity-framework

Entity Framework Core: A second operation started on this context before a previous operation completed EF Core add-migration Build Failed Entity Framework Core add unique constraint code-first 'No database provider has been configured for this DbContext' on SignInManager.PasswordSignInAsync The instance of entity type cannot be tracked because another instance of this type with the same key is already being tracked Auto-increment on partial primary key with Entity Framework Core Working with SQL views in Entity Framework Core How can I make my string property nullable? Lazy Loading vs Eager Loading How to add/update child entities when updating a parent entity in EF