After installing and uninstalling EF 6.1.3 in several projects of my solution, when I wanted to use it I had the following problem:
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.
I have EF wrapped , to avoid referencing EF assemblies in other projects, with the Unit of Work pattern.
I've been researching SOen on the following questions and they couldn't solve my problem:
- No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SqlClient'
- No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SqlClient'.
- Entity Framework Provider type could not be loaded?
- Error: No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SqlClient'
I chose not to apply the following solutions because, in my opinion, they raise doubts about their implementation and are walk-arounds :
- Load the assembly to Java; by calling the provider instance.
- Reference the EF in the initial project, along with its provider.
- Make a post-compile copy of the file
EntityFramework.SqlServer.dll
After a lot of fiddling I solved it by deleting the EF related entries in
app.config
every project in the solution, except where I implement Code First .Apparently, when EF wants to load the SqlServer provider assembly , it looks for such an assembly in the project where it has the provider definition and where the initial call (the first call on the call stack) is made. In my case, it was the project where I had the Windows forms, in the presentation layer.
Still, before I figured this out, go through the following checklist so I can resolve potential issues in between.
After that, I proceeded with the reinstallation of EF:
Install-Package EntityFramework
EntityFramework.SqlServer
make a local copy.