VS 2017 MySql.Data manifest does not match the assembly reference


I've had some problems following migration of a software project to a new machine. I'm trying to get VS2017, MySql.data and my MySQL database working together. I get a long error message (below) implying that my mySql.Data version ( manifest does not match the assembly reference (I don't quite understand the concept of this). The bug is weirdly intermittent - sometimes things seem to be working (partially), other times not. The error:

"Code generation for property 'Connection' failed. Error was: 'Property accessor ' Connection' on object 'TableAdapterManager' threw the following exception: 'Could not load file or assembly 'MySql.Dat, Version=, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)"

I am using the Data Sources feature of VS to add datatables + datatable adaptors via the design view.

Firstly, I had to follow some guidance to get VS2017 working with MySQL. I couldn't just install the latest versions of "MySQL Connector" and "MySQL for Visual Studio" as this didn't work, producing a "usable connection already" error. I followed this here, which involves installing MySQL Connector 6.9.8 + MySQL for VS 1.2.7 which got things working in that regard.

I've also downloaded MySql.data via NuGet Package Manager, V8.0.16.0

Some of the things I've read + tried:

  1. Ensuring right version of mySql in app.config: there's no references to this in my app.config files.

  2. Re-doing the connection string through settings - didn't resolve

  3. Altering "machine.config" - I updated the dependentAssembly element as below:

    <assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
    <bindingRedirect oldVersion="" newVersion="" />

  4. Changing the build to x86

  5. Tried to install MySql.data 6.9.8 via NuGet Console Install-Package MySql.Data -Version 6.9.8 ... package has been unlisted - error on download.

I'm pretty frustrated that it's so hard to get a well established technology such as MySQL working with Visual Studio. It's causing a really frustrating backlog in my dev so would really appreciate any advice.

asked on Stack Overflow May 25, 2019 by stigzler

1 Answer


I think it's a rite of passage to experience this error with Newtonsoft.JSON. We've all seen that error, or will see it. But today I received this error message for Mysql.Data and so like you I am forced to find a fix.

And like you, I have performed the ritual of deleting the bin/obj folders, checking out that binding redirect line, uninstalling and reinstalling the MySql.Data NuGet package, etc.

I think what solved it for me in this particular case is deleting all instances of Mysql.Data.dll from my solution directory (I had it in various bin folders as many projects use the class library that uses MySql.Data).

answered on Stack Overflow Jan 1, 2020 by jspinella

User contributions licensed under CC BY-SA 3.0