MySQL Connector with EF6 in Visual Studio 2013

asp.net-mvc c# entity-framework mysql

Question

I am attempting to connect to MySQL through a C# .NET web MVC application.

My issue is that, when I attempt to add an ADO.NET Entity Data Model, generated from Database, based on my MySQL connection, I get the following error message:

Your project references the latest version of Entity Framework; however, an Entity Framework database provider compatible with this version could not be found for you data connection. Exit this wizard, install a compatible provider, and rebuild your project before performing this action

I'm running the following software, upgrades & add-ons:

  • Visual Studio 2013
  • MySQL Server v5.6.21
  • MySQL For Visual Studio v1.2.3
  • Connector/NET v6.9.4

NuGet packages:

  • EntityFramework v6.1.1
  • MySQL.Data v6.9.3
  • MySQL.Data.Entities v6.8.3.0
  • SQL.Web v6.9.3

My web.config, entityFramework block:

    ..
</system.webServer>
<entityFramework>
  <defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.Entity.EF6" />
  <providers>
    <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" />
  </providers>
</entityFramework>
<runtime>
    ..

I have looked at all other solutions I could find here on SO and generally through google, tried all of them and none of the solutions seems to have worked or have been for very different versions of Connector/NET or other of the programs needed.

Can anyone spot what I am doing wrong?

1
21
7/23/2015 6:54:00 AM

Accepted Answer

Basic solution is to reinstall MySQL and VisualStudio including Entity and .NET.

For some reason, I am not certain why, the installation process corrupts the DLLs, or at least that is the experience I had and other colleagues. Our solution has been to try all of above with to no avail. So in the end we tried to reinstall, and it worked. So try that :)

8
5/30/2016 10:04:21 AM

Popular Answer

I had the same issue. After installing:

  • Visual Studio 2013 Community Edition
  • MySQL for Visual Studio 1.2.3
  • MySQL Connector .NET 6.9.5

I didn't want to reinstall Visual Studio, so after some tests, I found that the folder "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PrivateAssemblies" contained old versions of the following files:

  • MySql.Data.dll
  • MySql.Data.Entity.EF6.dll
  • MySql.Web.dll

After closing Visual Studio, I replaced these files with those in "C:\Program Files (x86)\MySQL\MySQL Connector Net 6.9.5\Assemblies\v4.5", and now it works!

Note: replace 6.9.5 in the subfolder name above, with the actual version installed in your system.



Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow