Your project references the latest Entity Framework; However, the version-compatible Entity Framework database required for data linking is not found EF6 techniques for using MySQL

Source: Internet
Author: User

  

Using MySQL connection in vs2013 entityframework often encounters this problem: your project references the latest Entity Framework, but the version-compatible Entity Framework Data provider required for the data connection cannot be found. Exit this wizard, install a compatible provider, rebuild your project, and then perform the action.

The problem with MySQL in VS is that it hurts a lot of people. Here to give a complete one-stop commentary ha.

< no patience to see the process explained directly under the bottom >

When creating the entity model, the data source option is probably not MySQL database, this problem is easy to solve, only need to install Mysql-for-visualstudio can be resolved, the recommended version here is mysql-for-visualstudio-1.2.3. Also need to install a MySQL connector/net, let's take a look at the introduction from official website: MySQL official. NET driver, MySQL official. NET client Development package. MySQL Database latest version dotnet database connection driver. So obviously, this program must be installed, the recommended version here is mysql-connector-net-6.8.3. PS: Here to remind, this version is not the higher the more appropriate, to match your mysql.data version, most of the time is the use of Mysql.data version 6.8.3 this edition. If the installation is higher than the mysql-connector-net-6.8.3 version, the Machine.config under VS will be modified after installation:

<dependentAssembly>

<assemblyidentity name= "Mysql.data" publickeytoken= "c5687fc88969c44d" culture= "neutral"/>
<bindingredirect oldversion= "6.7.4.0" newversion= "6.8.3.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyidentity name= "MySql.Data.Entity" publickeytoken= "c5687fc88969c44d" culture= "neutral"/>
<bindingredirect oldversion= "6.7.4.0" newversion= "6.8.3.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyidentity name= "Mysql.web" publickeytoken= "c5687fc88969c44d" culture= "neutral"/>
<bindingredirect oldversion= "6.7.4.0" newversion= "6.8.3.0"/>
</dependentAssembly>

<add name= "MySQL data Provider" invariant= "MySql.Data.MySqlClient" description= ". Net Framework Data Provider for MySQL "Type=" MySql.Data.MySqlClient.MySqlClientFactory, Mysql.data, version=6.8.3.0, Culture=neutral, Publickeytoken=c5687fc88969c44d "/>

Here is the Machine.config modified after installing the 6.8.3 version

When you install version 6.9.4, the newversion = "6.9.4" causes a number of late problems: for example, a reference problem: Could not load file or assembly ' Mysql.data, versio=6.8.3 ' ERROR number: 0x80131040 Such an assembly mismatch problem, in many forums have seen this problem, the resulting approach is mostly because Machine.config was modified to force a high version, resulting in an assembly mismatch.

Of course, if you fix this problem by manually modifying Machine.config, you can solve it temporarily, but it will cause a lot of unnecessary problems later, so it is recommended to install mysql-connector-net-6.8.3 directly.

After these two installs, congratulations, go to the next error, vs will prompt the above image error.

The answer to this wrong solution online can be said to be a lot of wonderful flowers blossoming. In fact, the solution is very simple, they have said, can not find the data connection required version-compatible Entity Framework Data provider.

The NuGet manager needs to be installed here first

In-tools-Library Package Manager-Package Manager console Here default project, enter after pm>


Install-package entityframework-version 6.0.0
Install-package entityframework.zh-hans-version 6.0.0
Install-package MySql.Data.Entity.EF6

After each sentence, enter the execution

Allows you to reload config.

This is an important step in adding a mysql.data.MysqlClint node to the providers.

<provider invariantname= "MySql.Data.MySqlClient" type= "MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6 "></provider>

The effect is as follows

<providers>

<provider invariantname= "System.Data.SqlClient" type= "System.Data.Entity.SqlServer.SqlProviderServices, Entityframework.sqlserver "/>
<provider invariantname= "MySql.Data.MySqlClient" type= "MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6 "></provider>

</providers>

In this step, regenerate the plan!

Haha not Microsoft's pro-son is a matter of much!

Here is a small summary. To short-tempered friends to see:

To be installed:

mysql-for-visualstudio-1.2.3

mysql-connector-net-6.8.3

NuGet Package Manager

NuGet console input

Install-package entityframework-version 6.0.0
Install-package entityframework.zh-hans-version 6.0.0
Install-package MySql.Data.Entity.EF6

Add a node to the providers of the. config

<provider invariantname= "MySql.Data.MySqlClient" type= "MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6 "></provider>

Complete.

Ha ha!! Don't Ask Love!

  

Your project references the latest Entity Framework; However, the version-compatible Entity Framework database required for data linking is not found EF6 techniques for using MySQL

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.