找不到Dll异常MYSQL Connector-.Net

时间:2019-02-23 23:17:49

标签: mysql mysql-connector

  

System.DllNotFoundException:

     

MySql.Data.MySqlClient.MySqlProviderServices,MySql.Data.Entity,Version = 6.9.12.0,Culture = neutral,PublicKeyToken = c5687fc88969c44d

1 个答案:

答案 0 :(得分:1)

我坚持了几个小时,对我来说唯一的方法是:

卸载MySql连接器

从引用中删除MySql.Data

从引用中删除MySql.Data.EF

从引用中删除EntityFramework

从Nuget软件包中卸载MySql.Data

Microsoft从Nuget软件包中卸载实体框架

https://downloads.mysql.com/archives/c-net/安装Mysql Connector 6.9.12

从Nuget软件包安装MySql.Data 6.9.12

通过Nuget软件包通过Microsoft 5.0.0.0安装实体框架

添加引用:MySql.Data 6.9.12; MySql.Data.EF 6.9.12

在app.config中,您需要这样做:

  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-6.9.12.0" newVersion="6.9.12.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>

在package.config中,您需要这样做:

  <package id="EntityFramework" version="5.0.0" targetFramework="net461" />
  <package id="MySql.Data" version="6.9.12" targetFramework="net461" />

我不确定它是否对您有用,但是当我两天前遇到相同的错误时,它对我有用。