.Net 项目中 MySql.Data.dll 的冲突版本不允许我在我的数据集中添加/编辑 TableAdapters [英] Conflicting versions of MySql.Data.dll in .Net project not allowing me to add/edit TableAdapters in my DataSets

查看:17
本文介绍了.Net 项目中 MySql.Data.dll 的冲突版本不允许我在我的数据集中添加/编辑 TableAdapters的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Visual Studio 2015 Update 3 中有一个 WinForms/.Net 4.0 应用程序.当我尝试在我的任何数据集中添加或编辑 TableAdapter 时,我收到此错误:

I have a WinForms / .Net 4.0 application in Visual Studio 2015 Update 3. When I try to add, or edit, a TableAdapter in any of my DataSets, I get this error:

向导在配置时检测到以下问题表适配器:

The wizard detected the following problems when configuring the TableAdapter:

详情:

生成的 SELECT 语句.[A]MySQL.Data.MySqlClient.MySqlConnection不能转换为 [B]MySQL.Data.MySqlClient.MySqlConnection.A型源自 'MySQL.Data 版本 6.9.8.0,Culture=neutral,PublicToken=c5687fc88969c44d' in context 'Default' at位置 'C:Program Files (x86)Microsoft Visual Studio14.0Common7IDEPrivateAssembliesMySQL.Data.dll'.B 型源自 'MySQL.Data,版本 6.9.9.0,Culture=neutral,PublicKeyToken=c5687fc88969c44d' 在上下文默认"位置'C:WindowsMicrosoft.NetassemblyGAC_MSILMySQL.Datav4.0_6.9.9.0_c5687fc88969c44dMySQL.Data.dll'.

Generated SELECT statement. [A]MySQL.Data.MySqlClient.MySqlConnection cannot be cast to [B]MySQL.Data.MySqlClient.MySqlConnection. Type A originates from 'MySQL.Data Version 6.9.8.0, Culture=neutral,PublicToken=c5687fc88969c44d' in context 'Default' at location 'C:Program Files (x86)Microsoft Visual Studio 14.0Common7IDEPrivateAssembliesMySQL.Data.dll'. Type B originates from 'MySQL.Data, Version 6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' in context 'Default' at location 'C:WindowsMicrosoft.NetassemblyGAC_MSILMySQL.Datav4.0_6.9.9.0_c5687fc88969c44dMySQL.Data.dll'.

显然它抱怨 MySQL.Data.dll 6.9.8 和 6.9.9 的两个不同版本.我不明白的是为什么或在哪里引用版本 6.9.8.0?如果我查看我的项目的引用,它使用的是 MySQL.Data.dll 版本 6.9.9.0.这是位于以下位置的 NuGet 包:

Obviously it is complaining about two different versions of the MySQL.Data.dll 6.9.8 and 6.9.9. What I don't understand though is why or where is it referencing version 6.9.8.0? If I look at my project's references, it is using MySQL.Data.dll version 6.9.9.0. This is a NuGet package at location:

C:UsersFabs-LenovoY70SourceWorkspacesTrackerTrackerpackagesMySql.Data.6.9.9lib et45MySql.Data.dll

C:UsersFabs-LenovoY70SourceWorkspacesTrackerTrackerpackagesMySql.Data.6.9.9lib et45MySql.Data.dll

我已经尝试了 [A]MySql.Data.MySqlClient.MySqlConnection 无法转换为 [B]MySql.Data.MySqlClient.MySqlConnection 但没有工作.

I've tried the solution at [A]MySql.Data.MySqlClient.MySqlConnection cannot be cast to [B]MySql.Data.MySqlClient.MySqlConnection but didn't work.

我在整个解决方案中搜索了对 6.9.8 的任何引用,但一无所获.我已经用谷歌搜索了一整天的解决方案,但没有发现任何有效的方法.:( 有什么想法吗?谢谢...

I've searched my entire solution for any references to 6.9.8 and I've found nothing. I've been Googling for a solution for a whole day now and have found nothing that's worked. :( Any ideas anyone? Thank you...

推荐答案

我在 VS 2012 中遇到了同样的问题.我不知道如何解决它,但在花了相当多的时间后,我看到了正在发生.

I am having the same issues with VS 2012. I am not sure how to fix it but after spending quite a bit of time on it here is what I see is happening.

  1. 你/我的所有系统都是 mysql.data.dll 版本 6.9.9.0.我无法将其降级到 6.9.8.0 当我这样做时,我创建了 mysql.data.dll 的其他版本问题,这些问题似乎无法以我的知识水平解决.

  1. Over all your/my system is at mysql.data.dll version 6.9.9.0. I am not able to downgrade this to 6.9.8.0 When I do I create other version problems with mysql.data.dll that seem to be unresolveable with my knowledge level.

我追查了所有 6.9.8.0 版本的 DLL 并删除了它们,确保有 6.9.9 版本代替它.完成此操作后,我无法将数据连接添加到 MySQL 数据库.当我尝试时,我收到错误发生错误,这通常是由于没有正确安装 Visual Studio 造成的.此外,之前定义的数据连接都不起作用.

I chased down all 6.9.8.0 versions of the DLL and removed them, ensuring that there was a 6.9.9 version in its place. Once I have done this I am not able to add a data connection to a MySQL Database. When I try I get the error An error occurred that is normally caused by not having Visual Studio properly installed. In addition non of the previously defined data connections work.

未安装 MYSQL-connector-net-6.9.9 会出现无法为名为 MySql.Data.MySqlClient 的数据提供程序获取提供程序工厂"的错误,您甚至不会遇到上述错误OP.

Not having MYSQL-connector-net-6.9.9 installed gives an error of "Cannot obtain provider factory for data provider named MySql.Data.MySqlClient" and you don't even get to the error described above by the OP.

  1. 我尝试了各种连接器网络版本,但这并不能解决问题.

我在我的任何项目中都没有引用 6.9.8.0,但显然出于某种原因 VS 需要它来创建数据连接.

I have no references to 6.9.8.0 in any of my projects but clearly for some reason VS needs it to create the data connections.

更新:

我删除了 MySQL,然后检查并删除了所有 mysql*.dll 和所有配置文件.然后我使用了位于 http://dev.mysql.com/downloads/installer 的 MySQL Installer 5.7.14/

I removed MySQL, then went through and deleted all mysql*.dll and all config files. I then used the MySQL Installer 5.7.14 found at http://dev.mysql.com/downloads/installer/

安装程序仍然安装了 mysql.data.dll 版本 6.9.8.0 并且仍然导致错误.

The installer still installed the mysql.data.dll version 6.9.8.0 and it still causes the error.

更新:问题出在 MySQL 连接器/网络上.它使用 DLL 的 6.9.9.0 版本,其他一切都使用 6.9.8.0 转到您的社区安装程序并卸载连接器/网络.然后去https://downloads.mysql.com/archives/c-net/ 并获得 6.9.8 版的连接器/网络.安装这个,一切都应该没问题.它已在我的系统上运行.

Update: The problem is with MySQL Connector / Net. It is using version 6.9.9.0 of the DLL and everything else is using 6.9.8.0 Go to your community installer and uninstall connector / net. Then go to https://downloads.mysql.com/archives/c-net/ and get version 6.9.8 of the connector / net. Install this and everything should be fine. It has worked on my system.

这篇关于.Net 项目中 MySql.Data.dll 的冲突版本不允许我在我的数据集中添加/编辑 TableAdapters的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆