After downloading the EF6 by nuget and try to run my project, it returns the following error:
No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SqlClient'. Make sure the provider is registered in the 'entityFramework' section of the application config file. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.
The startup project that references the project where Entity Framework is being used needs the following two assemblies in it's bin folder:
Adding a
<section>
to the<configSections>
of the .config file on the startup project makes the first assembly available in that bin directory. You can copy this from the .config file of your Entity Framework project:To make the second .dll available in the bin folder, although not practical, a manual copy from the bin folder of the Entity Framework project can be made. A better alternative is to add to the Post-Build Events of the Entity Framework project the following lines, which will automate the process:
I had a related issue when migrating from a CE db over to Sql Server on Azure. Just wasted 4 hrs trying to solve this. Hopefully this may save someone a similar fate. For me, I had a reference to SqlCE in my packages.config file. Removing it solved my entire issue and allowed me to use migrations. Yay Microsoft for another tech with unnecessarily complex setup and config issues.
Add this function
to database context class in the library class and the missing DLL EntityFramework.SqlServer.dll will be copied to the correct places.
.
I tried almost all the above and nothing worked.
Only when I set the referenced DLLs in the Default Project
EntityFramework
andEntityFramework.SqlServer
propertiesCopy Local
toTrue
did it start working!I had the identical exception thrown. I included
and everything is back to working again ..
Also, make sure you startup project is the project that contains your dbcontext (or relevant app.config). Mine was trying to start up a website project which didnt have all the necessary configuration settings.