entity framework Unable to load the specified metadata resource

.NetEntity Framework

.Net Problem Overview


> 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'.

.Net Solutions


Solution 1 - .Net

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= <!-- ... -->

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionWraithNathView Question on Stackoverflow
Solution 1 - .NetPsychoCoderView Answer on Stackoverflow