Bug #82617 Can't create a Data Source in VS2012 & VS2015
Submitted: 17 Aug 2016 17:18 Modified: 27 Sep 2019 14:09
Reporter: C B Email Updates:
Status: Closed Impact on me:
Category:Connector / NET Severity:S2 (Serious)
Version:6.9.9 OS:Windows (Windows 7)
Assigned to: CPU Architecture:Any
Tags: connector / net, DLL version conflict

[17 Aug 2016 17:18] C B
Not possible to create a dataset or table adapter in Visual Studio 2012 & 2015 due to conflicting versions of MySQL.Data.dll .

This means that no reports can be created or possibly even used. 

The error message is:

    The wizard detected the following problems when configuring the TableAdapter:


    Generated SELECT statement. [A]MySQL.Data.MySqlClient.MySqlConnection cannot be cast to [B]MySQL.Data.MySqlClient.MySqlConnection. Type A originates from 'MySQL.Data Version, 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, 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'.

< end error message > 

Attempting to resolve this I removed MySQL completely and deleted all mysql*.dll files on system.  I then install the current version of MySQL Installer 5.7.14 found at http://dev.mysql.com/downloads/installer/.  After the installation it was found that this installer still installed 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\PrivateAssemblies\MySQL.Data.dll'  as version 

How to repeat:
Install MySQL for Visual Studio using installer 5.7.14 found at http://dev.mysql.com/downloads/installer/

Check the the version of 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\PrivateAssemblies\MySQL.Data.dll'  is version 

1) Create a project.  

2) Execute Project> Add New Item > Data > DataSet  press Add.  This starts the wizard.

3) Right click in the DataSetx.xsd and select add > Table Adapter

4) Work your way through creating the table adaptor and enter a valid SQL Statement

5)Press Finish button and you will get the error.

Suggested fix:
Need to install the correct version of MySQL.Data.dll.

However replacing file version with creates an error in Visual Studio and no connections can be created so there is a little more to this than just replacing the file version.
[17 Aug 2016 17:21] C B
Further info = http://stackoverflow.com/questions/38891056/conflicting-versions-of-mysql-data-dll-in-net-...
[17 Aug 2016 17:27] C B
Error Message Screen Shot

Attachment: MySQL.Data.dll-version-conflict.png (image/png, text), 94.16 KiB.

[17 Aug 2016 17:28] C B
Screen Shot Added
[17 Aug 2016 20:45] C B
Figured out the problem I think.   Connector / Net is using 6.9.9 but the data adapter is using 6.9.8 as this is what is installed by one of the other installers in the MySQL Installer.  

I downloaded an archived  installer   5.7.13  from https://downloads.mysql.com/archives/installer/  and it also installed Connector / net 6.9.9.  Again there was a conflict.  

I then removed the connector / net 6.9.9 from this install and then installed the archived  connector / net  6.9.8 from https://downloads.mysql.com/archives/c-net/

This fixed the problem. Now data adapters can be created. 

I don't know which installer in the MySQL Installer is installing 6.9.8
[18 Aug 2016 7:03] Chiranjeevi Battula
Hello CB,

Thank you for the bug report.
I'm glad that you found a solution for your problem and let us know if you are still having the issue with complete repeatable steps.

[18 Aug 2016 12:53] C B

I have found a work around to a bug in your installer.  The installer still needs to be fixed and it took me well over 20 hours to fix this problem.   I think you need to fix your installer so that it is not installing incompatible versions of the dll's.   

[29 Sep 2016 5:48] Chiranjeevi Battula
http://bugs.mysql.com/bug.php?id=83190 marked as duplicate of this one.
[28 Nov 2016 21:37] Lou Gibson
I've been getting exactly this problem - fighting with it for two days.  Uninstalled Connector/Net 6.9.9 using the MySql Installer.  Downloaded the 6.9.8 Connector/Net msi and installed from there.  Now I can create a TableAdapter for a MySQL database.  YEAY!  THANK YOU!

I got into this trouble by installing Visual Studio 2015 Community Edition, then using the MySQL Installer to install MySQL for VIsual Studio, then running it again to install Connector/NET 6.9.9 (the only option).  

OS is Windows 10
[19 Sep 2017 8:22] Chiranjeevi Battula
http://bugs.mysql.com/bug.php?id=87798 marked as duplicate of this one.
[20 Nov 2017 7:15] Chiranjeevi Battula
http://bugs.mysql.com/bug.php?id=88544 marked as duplicate of this one.
[21 Nov 2017 7:37] Chiranjeevi Battula
http://bugs.mysql.com/bug.php?id=88570 marked as duplicate of this one.
[27 Sep 2019 14:09] Christine Cole
Posted by developer:
Fixed as of the upcoming MySQL for Visual Studio 1.2.9 release, and here's the changelog entry:

MySQL for Visual Studio now prompts for action when it detects any
conflicts in its configuration files that were introduced after MySQL for
Visual Studio was installed. Errors associated with this type of
configuration conflict prevent the creation of data sources and table

A new Configuration Update Tool can resolve the conflicts
between Connector/NET and MySQL for Visual Studio libraries as they are
detected (see MySQL for Visual Studio Configuration Update Tool). To
complete the action, it is necessary to restart affected versions of
Visual Studio manually after the tool finishes updating the files.

Thank you for the bug report.