C# 使用mySQL VisualStudio 2019的实体框架

C# 使用mySQL VisualStudio 2019的实体框架,c#,entity-framework,mysql-connector,C#,Entity Framework,Mysql Connector,我得到这个错误: System.InvalidOperationException:“无法加载在ADO.NET提供程序的应用程序配置文件中注册的实体框架提供程序类型”MySql.Data.MySqlClient.MySqlProviderServices,MySql.Data.EntityFramework,Version=8.0.18.0,Culture=neutral,PublicKeyToken=c5687fc88969c44d”,该提供程序的固定名称为“MySql.Data.MySqlC

我得到这个错误:

System.InvalidOperationException:“无法加载在ADO.NET提供程序的应用程序配置文件中注册的实体框架提供程序类型”MySql.Data.MySqlClient.MySqlProviderServices,MySql.Data.EntityFramework,Version=8.0.18.0,Culture=neutral,PublicKeyToken=c5687fc88969c44d”,该提供程序的固定名称为“MySql.Data.MySqlClient”。确保使用了程序集限定名称,并且运行的应用程序可以使用该程序集

这是我的app.config文件。我不明白为什么我会犯这个错误。我已经被其他帖子困了好几天,没有提供任何帮助

<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>


编辑:当您尝试显示提供者的System.Data.SqlClient时,我发现它与另一个项目(webapp)中的app.config有某种关联。它引发此异常

看起来您的应用程序无法加载MySql.Data.EntityFramework Version=8.0.18.0,您尝试过通过NuGet安装它吗


看起来您的应用程序无法加载MySql.Data.EntityFramework版本=8.0.18.0,您是否尝试过通过NuGet安装它


您运行的是哪个.Net framework版本?您是否确保使用了正确的程序集限定名称,并且该程序集可供运行的应用程序使用?我该怎么做?对不起,我是新来的this@Deletedv4.7.2您可以删除或注释掉其中一个提供程序,反之亦然。您有两个,我想您只需要一个。您运行的是哪个.Net framework版本?您是否确保使用了正确的程序集限定名,并且该程序集可供正在运行的应用程序使用?我该怎么做?对不起,我是新来的this@Deletedv4.7.2您可以删除或注释掉其中一个提供程序,反之亦然。你有两个我想你只需要一个我已经安装好了我已经安装好了