1

I'm trying to add a new MySql database connection. My version of MySql.Data is 6.9.9.0 and is referenced as this in my EFModel project's app.config and in the Nuget Package Manager of the project.

When I test it, the connection with my server is well established, but when I click on "OK" it displays an error:

"Could not load file or assembly 'MySql.data, Version=6.9.8.0, Culture=Neutral, PublicKeyToken=BigNumber' or one of his dependencies. The found definition of the assembly's manifest doesn't correspond to the reference of the assembly."

The issue is that this version is not wrote in my solution in any config files.

Here is my app.config file:

<?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" />

  <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --></configSections>
  <entityFramework codeConfigurationType="MySql.Data.Entity.MySqlEFConfiguration, MySql.Data.Entity.EF6">
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
    <providers>
      <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" />
    </providers>
  </entityFramework>
  <connectionStrings>
    <add name="UphairDbEntities" connectionString="metadata=res://*/DbModel.csdl|res://*/DbModel.ssdl|res://*/DbModel.msl;provider=MySql.Data.MySqlClient;provider connection string=&quot;server=***;user id=***;password=***;database=***&quot;" providerName="Mysql.Data.MysqlClient" />
  </connectionStrings>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
  </startup>
  <system.data>
    <DbProviderFactories>
      <remove invariant="MySql.Data.MySqlClient" name="MySQL Data Provider" />
      <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
    </DbProviderFactories>
  </system.data>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-6.8.3.0" newVersion="6.8.3.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

I'm struggling on this for 3 days but couldn't find any solution or related issue in SO or internet since every issues I found weren't about adding a new connection to a database nor about the version displayed on the error not listed in app.config which is my case. I really don't understand what can causes this.

Please help ! :/

4

3 回答 3

2

[重复] .Net 项目中 MySql.Data.dll 的冲突版本不允许我在我的数据集中添加/编辑 TableAdapters

我只需要卸载 MySql 连接器 6.9.10 然后安装6.9.8.0版本,如我的答案顶部的重复链接中所述,我不必添加新连接,我的两个连接项目的基础是显示得很好!

据我说,这个以前版本的 MySql 连接器的链接很难找到!

但现在我松了一口气,希望这可以帮助其他人:D

于 2017-11-09T18:53:25.400 回答
0

当 .csproj 文件中的 MySql.data 版本与 App.config 文件中的版本不匹配时(由于手动更改等),可能会发生这种情况。尝试卸载软件包并重新添加。

于 2020-02-13T10:24:36.360 回答
0

无需搜索太多。它告诉您它尝试加载的程序集与您的 application.config 文件中引用的程序集的版本不匹配。

要在此处引用另一个问题:

.NET 程序集加载器无法找到 1.2.0.203,但确实找到了 1.2.0.200。此程序集与请求的内容不匹配,因此您会收到此错误。简单来说,就是找不到被引用的程序集。确保它可以通过将其放入 GAC 或应用程序路径中找到正确的程序集。

找到的程序集的清单定义与程序集引用不匹配

这也链接在另一个答案中:名为 xxx.dll 的已定位程序集的清单定义与程序集引用不匹配

希望有帮助。

于 2017-11-09T09:12:01.147 回答