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:
NuGet packages:
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?
To use Entity Framework Core with a MySQL database, do the following: Install the NuGet package. When you install either the MySql. EntityFrameworkCore or MySql.
Connect C# to MySQLAll the communication between a C# application and the MySQL server is routed through a MySqlConnection Object. So, before your application can communicate with the server, it must instantiate, configure, and open a MySqlConnection object.
I had the same issue. After installing:
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:
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.
This worked for me WITHOUT reinstalling the Visual Studio or anything what so ever.
<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" /> <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> </providers> </entityFramework>
NOTE: Make sure you remove only the entityFramework tag and its children, and replace it with the snipped above. If you delete any "extra" tags you might have even bigger problems with your project, like I did. X)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With