Unable to find the requested .Net Framework Data Provider. It may not be installed


Question

This morning I suddenly got this exception when trying to add a custom migration step to our EF Code-first migrations:

The ADO.NET provider with invariant name '.NET Framework Data Provider for SQL Server' is either not registered in the machine or application config file, or could not be loaded.

I have no problem executing a update-database against our SQL Server but the add-migration command fails.

We are using.Net 4.5.1 with EF Code First 6.0.1 against SQL Server 2012.

Our configuration file for our data project is this:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="System.Data.SqlClient" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>
  <connectionStrings>
    <add name="Data.StorageContext" connectionString="server=.\MSSQL01;Database=OutageTracking; Integrated Security=True; MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
  </connectionStrings>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
  </startup>
</configuration>

Note that Visual Studio 2012 complains about the -element in the -section.

Any thoughts?

Thanks,

/Jesper

Accepted Answer

".NET Framework Data Provider for SQL Server" is not an invariant name, so some .config file somewhere must be in a bad state





Licensed under: CC-BY-SA
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why