Can't Create Entity Data Model - using MySql and EF6
I just had the same situation when trying to configure Visual Studio Professional 2017 environment with MySQL, ADO.NET (Database First) and EF6.
Note: Please follow steps in the same order.
-
Uninstall/remove "Connector/NET" and "MySQL for Visual Studio" if installed.
-
Install "MySQL for Visual Studio" v2.0.5 CTP (MySQL for Visual Studio). Note: Install MySQL for Visual Studio before Connector/NET.
-
Install "Connector/NET" v6.9.10 (Connector/Net). https://i.stack.imgur.com/XOT1I.jpg Note: I tried using Connector/NET v6.8, v6.10 and v8 first, but none of them worked with Visual Studio 2017 and ADO.Net. Here you can find all Connector Versions and Compatibilities with Visual Studio IDEs, but so far this list is inaccurate.
-
Create new Visual Studio Professional 2017 project.
-
Download and Install "EntityFramework" v6.2.0 through NuGet, by going to Project Tab/Manage NuGet Packages/Browse -> Entity Framework.
-
Add references to
C:\Program Files (x86)\MySQL\Connector.NET 6.9.10\Assemblies\v4.5\MySql.Data.dll
andC:\Program Files (x86)\MySQL\Connector.NET 6.9.10\Assemblies\v4.5\MySql.Data.Entity.EF6.dll
; by Right Clicking over References inside Solution Explorer and selecting Add Reference/Browse ->Browse button. -
Add MySQL EF6 provider info inside App.config under entity framework providers as follow:
<entityFramework>
<providers>
<provider invariantName="MySql.Data.MySqlClient"
type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" />
</providers>
</entityFramework>
- Rebuild project by going to Build tab/Rebuild ProjectName.
And that's it. VS2017 is ready to go. Hope this works for everybody, as it did for me today.
References:
-
Can't Create Entity Data Model - using MySql and EF6
-
No Entity Framework provider found for 'MySql.Data.MySqlClient' ADO.NET provider
I solved this issue by following some steps below:
Uninstall
MySql.Data.Entities
from Nuget by using command below in Package Manager Console:Uninstall-Package MySql.Data.Entities
Add project reference to the latest
MySql.Data.Entity.EF6.dll
from your MySql connector installation path at:C:\Program Files (x86)\MySQL\MySQL Connector Net 6.9.8\Assemblies\v4.5
VS 2015 still has this bug. It is caused by version mismatch.
On my system, I had MySQL Connector 6.9.6.
Issuing the command in NuGet Package Manger Console:
Install-Package MySql.Data.Entity
installs version 6.9.8 by default. Your connector must match the actual version of the NuGet Package.
You can download an updated version of the connector from:
https://www.mysql.com/products/connector/
Here select the "Ado.net driver for MySQL", and download the corresponding version (in this case 6.9.8). Reopen Visual Studio and now the wizard does not crash. No reboot required.
I was able to resolve this problem by performing the following:
- Open MySQL Installer and install the latest version of Connector/NET
- Uninstall / reinstall the latest version MySQL.Data.* packages with versions that match the version of the newly installed Connector/NET package
- Restart Visual Studios
- Rebuild solution
Taking suggestions about NuGet versioning from others answers.
I solved this issue by deleting the .Data
and Data.Entitiy.EF6
installed by Nuget.
Then right click on References and browse for:
C:\Program Files (x86)\MySQL\Connector.NET 6.9\Assemblies\v4.5\MySql.Data.dll
and
C:\Program Files (x86)\MySQL\Connector.NET 6.9\Assemblies\v4.5\MySql.Data.Entity.EF6.dll
I was then able to complete the ADO.Net wizard, with the .edmx models.