1

I get this error:

System.InvalidOperationException: 'The Entity Framework provider type 'MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.EntityFramework, Version=8.0.18.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' registered in the application config file for the ADO.NET provider with invariant name 'MySql.Data.MySqlClient' could not be loaded. Make sure that the assembly-qualified name is used and that the assembly is available to the running application.

This is my app.config file. I cant figure out why i get this error. I've been stuck for days with other posts not giving any help.

<configuration>
  <configSections>
  <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
  <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-8.0.18.0" newVersion="8.0.18.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.ComponentModel.Annotations" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.2.1.0" newVersion="4.2.1.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <entityFramework codeConfigurationType="MySql.Data.Entity.MySqlEFConfiguration, MySql.Data.Entity.EntityFramework">
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="mssqllocaldb" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
      <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.EntityFramework, Version=8.0.18.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
    </providers>
  </entityFramework>
  <connectionStrings>
    <add name="StudentForYouEntities" connectionString="metadata=res://*/StudentForYouDataBase.csdl|res://*/StudentForYouDataBase.ssdl|res://*/StudentForYouDataBase.msl;provider=MySql.Data.MySqlClient;provider connection string=&quot;server=remotemysql.com;user id=dx01fvQECG;password=password;database=myDataBase;persistsecurityinfo=True&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>
</configuration>

EDIT: i found out that it is somehow related to app.config in another project(webapp) when you try to display provider 'System.Data.SqlClient' it throws this exception

7
  • what .Net framework version are you running on?
    – Deleted
    Dec 12, 2019 at 23:07
  • Have you made sure that the correct assembly-qualified name is being used and that the assembly is available to the running application? Dec 12, 2019 at 23:10
  • How do i that? sorry new to this Dec 12, 2019 at 23:11
  • @Deleted v4.7.2 Dec 12, 2019 at 23:12
  • Can you remove or comment out one of the Providers and vice versa. You have two I think you only need one.
    – Deleted
    Dec 12, 2019 at 23:14

1 Answer 1

1

Looks like your app can't load MySql.Data.EntityFramework Version=8.0.18.0, have you tried installing it via NuGet?

enter image description here

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.