No Entity Framework provider found for 'MySql.Data.MySqlClient' ADO.NET provider

前端 未结 11 692
青春惊慌失措
青春惊慌失措 2020-11-29 04:45

I\'m trying to use Entity Framework with MySQL and I get the above error. I have the latest MySQL connector installed.

The full error reads:

No Entit         


        
相关标签:
11条回答
  • 2020-11-29 05:11

    For future reference, here's the official guide on using MySQL Connector/Net with EF 6 which includes all the necessary steps (assemblies, configs, ...etc.): Chapter 10 EF 6 Support

    0 讨论(0)
  • 2020-11-29 05:12

    I tried every different combination of config string and setup but I finally figured it out. My solution has the source code in one project and tests in another. I was using Entity Framework 6.1.1 and had installed MySql Connector 6.8.3 and MySql for Visual Studio 1.2.3.

    The problem was that I had NuGet managing the packages, but only had them included in the main project. The solution was to

    1. Right click on the Solution (top level in the solution explorer)
    2. Manage Nuget packages for solution
    3. Go to Installed tab
    4. For all of the EntityFramework related packages (MySql.Data, MySql.Data.Entities, MySql.ConnectorNET.Entity and MySql.ConnectorNET.Data), select them then select the "Manage" button.
    5. Enable each package for all projects.
    0 讨论(0)
  • 2020-11-29 05:15

    Install latest version from nuget https://www.nuget.org/packages/MySql.Data.Entity/

    0 讨论(0)
  • 2020-11-29 05:19

    Just adding a summary of versions (since I saw you are trying 6.2 which is way too old)

    • For EF4, use Connector/NET 6.6.x (current GA is 6.6.6)
    • For EF5, use Connector/NET 6.7.x (current GA is 6.7.4) or Connector/NET 6.8.x (current GA is 6.8.3).
    • For EF6, use Connector/NET 6.8.x (current GA is 6.8.3).
    0 讨论(0)
  • 2020-11-29 05:20

    Nevermind. I noticed that I had EF 6 installed. I removed it and tried EF 5 instead (which NuGet says is the latest stable version) and it started working.

    Still, a more useful error message would have been nice!

    0 讨论(0)
提交回复
热议问题