The Entity Framework provider … could not be loaded

When you create a new Microsoft Visual Studio 2013 project that uses the Entity Framework you may get the following error message:
The Entity Framework provider type ‘System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer’ registered in the application config file for the ADO.NET provider with invariant name ‘System.Data.SqlClient’ could not be loaded. Make sure that the assembly-qualified name is used and that the assembly is available to the running application. See for more information.

  • Add the EntityFramework NuGet package to the Data Access project that accesses the database and the Web Application or Web Service project that calls the project
    • Right click the project in Solution Explorer
    • Select Manage NuGet Packages
    • On the left side select Online
    • On the right side enter EntityFramework into the search field
    • Click Install next to the EntityFramework package
  • Make sure your app config file contains the following lines:


  <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameter value="v11.0" />
    <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
  • Your project should contain a reference to EntityFramework.SqlServer.dll
  • Add the following line to the constructor of the class that accesses the database
var type = typeof(System.Data.Entity.SqlServer.SqlProviderServices);
  • Add the System.Data.Entity reference to the project accessing the database

Join the Conversation


  1. Hello, so I have a data layer project (class library (no config files)) that uses EF, but what if i don’t want my client project to reference EF at all, I want to abstract that out, is this possible? Based on what I have heard it should be

  2. As far as EF 6 goes, you do not have to install entity framework in the project that is referencing your entity framework project.
    All you have to do is make sure that you have the configuration entries as stated above and include the EntityFramework.dll and EntityFramework.SqlServer.dll (for the version you are using) as references in the project that is referencing the other project (the original one that uses ef6). If you have that, everything will work perfect.

Leave a comment

Your email address will not be published. Required fields are marked *