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

查看:181
本文介绍了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:

该向导在配置 TableAdapter:

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, 文化=中性,PublicToken = c5687fc88969c44d'在上下文默认"中位于 位置'C:\ Program Files(x86)\ Microsoft Visual Studio 14.0 \ Common7 \ IDE \ PrivateAssemblies \ MySQL.Data.dll'.类型B源自"MySQL.Data,版本6.9.9.0,Culture = neutral, 位置默认"上下文中的PublicKeyToken = c5687fc88969c44d" 'C:\ Windows \ Microsoft.Net \ assembly \ GAC_MSIL \ MySQL.Data \ v4.0_6.9.9.0_c5687fc88969c44d \ MySQL.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.0\Common7\IDE\PrivateAssemblies\MySQL.Data.dll'. Type B originates from 'MySQL.Data, Version 6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' in context 'Default' at location 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\MySQL.Data\v4.0_6.9.9.0_c5687fc88969c44d\MySQL.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:\ Users \ Fabs-LenovoY70 \ Source \ Workspaces \ Tracker \ Tracker \ packages \ MySql.Data.6.9.9 \ lib \ net45 \ MySql.Data.dll

我已经在上尝试了该解决方案[A] MySql.Data.MySqlClient.MySqlConnection无法转换为[B] MySql.Data.MySqlClient.MySqlConnection ,但无效.

我已经在整个解决方案中搜索了对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.

我追逐了DLL的所有6.9.8.0版本并删除了它们,确保已替换成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 Connector/Net.它使用的是DLL的6.9.9.0版,其他所有内容都在使用6.9.8.0.请转到社区安装程序并卸载连接器/net.然后转到 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天全站免登陆