We are using EntityFramework 6 with Code First. We have a console app that has no reference to EntityFramework but reads the connection string from its App.config. It call
You need to create a reference, so it will be copied in the debug folder. So later it can accessed in runtime.
Don't to copy any files, just create this reference:
private volatile Type _dependency;
public MyClass()
{
_dependency = typeof(System.Data.Entity.SqlServer.SqlProviderServices);
}
do you have the assembly EntityFramework.SqlServer.dll in your application path? I had the same Problem and after copying the dll into the application path every Thing worked fine.
Finally found the answer in this blog:
http://robsneuron.blogspot.com/2013/11/entity-framework-upgrade-to-6.html
The best way to get ride of such a kind of problem is to include the reference EntityFramework.SqlServer.dll into your project the press F4 (op the properties) change the property to Copy to Local =True so each and every time when publish the app it will be copied to the published folder.
I had this problem too. Everything worked locally when I ran my .net mvc app but when I published it I got this error. The problem was that I had to reference the EntityFrameworl.SqlServer also in my web project alhough I had seperate project for Data. What is strange is that this error was only thrown when app was published. This is some serious bug probably from Microsoft. I used EF 6.1.1.
I tend to add EntityFramework to the web project as well as the assembly that actually references it.