I am having some serious problems with Entity Framework and I can't seem to figure out whats going on.
I tried many options provided on: MetadataException: Unable to load the specified metadata resource and the famous Craig Stuntz's blog posting located at: http://blogs.teamb.com/craigstuntz/2010/08/13/38628/
I have 3 projects for the sake of brevity:
Funscribe.Data (EDMX file located here)
Funscribe.Console (Console app)
Funscribe.Web (MVC 3 app)
Originally it was just the MVC app and I recently added this new console project.
I copied the connection string from web.config and applied it to my app.config:
<add name="FundirectoryEntities" connectionString="metadata=res://*/Fundirectory.csdl|res://*/Fundirectory.ssdl|res://*/Fundirectory.msl;provider=System.Data.SqlClient;provider connection string="data source=localhostsqlexpress;initial catalog=Funscribe;user id=sys_Funscribe;password=blah;multipleactiveresultsets=True;application name=EntityFramework"" providerName="System.Data.EntityClient" />
My mvc app continues to work, but when I run the console app, i get the dreaded:
"Unable to load the specified metadata resource."
I tried changing the connection string to the wild card setting:
<add name="FundirectoryEntities" connectionString="metadata=res://*/;provider=System.Data.SqlClient;provider connection string="data source=localhostsqlexpress;initial catalog=Funscribe;user id=sys_Funscribe;password=blah;multipleactiveresultsets=True;application name=EntityFramework"" providerName="System.Data.EntityClient" />
I get: The specified default EntityContainer name 'FundirectoryEntities' could not be found in the mapping and metadata information.
I tried changing it to specify the assembly:
<add name="FundirectoryEntities" connectionString="metadata=res://Funscribe.Data.dll/Fundirectory.csdl|res://Funscribe.Data.dll/Fundirectory.ssdl|res://Funscribe.Data.dll/Fundirectory.msl;provider=System.Data.SqlClient;provider connection string="data source=localhostsqlexpress;initial catalog=Funscribe;user id=sys_Funscribe;password=blah;multipleactiveresultsets=True;application name=EntityFramework"" providerName="System.Data.EntityClient" />
I get: Unable to resolve assembly 'Funscribe.Data.dll'.
I am lost on what I should do here. I just upgraded this project to Visual Studio 2012 (I introduce this new console app after converting to VS 2012).
I also noticed that the Funscribe.Data.dll is located within the console project's bin folder, i manually deleted these files and watch it get recreated. And what puzzles me is the web app continues to work properly!
All projects are on .NET 4.0. The console app uses .NET 4.0 not the client profile verison.
Any help on this matter is greatly appreciated.
See Question&Answers more detail:os