简体   繁体   English

实体框架。 您的项目引用了最新版本的实体框架错误VS2017 MYSQL 8.0.12

[英]Entity Framework. Your Project References the latest version of entity framework error VS2017 MYSQL 8.0.12

I have a Visual Studio 2017 project that has Entity Framework 6.2 我有一个具有Entity Framework 6.2的Visual Studio 2017项目

When trying to create the edmx file I get the error 尝试创建edmx文件时出现错误

Your project references the latest version of Entity Framework; 您的项目引用了Entity Framework的最新版本; however, an Entity Framework database provider compatible with this version could not be found for you data connection 但是,找不到与您的数据连接兼容的Entity Framework数据库提供程序

I have had this many times but it has always been fixed by using the dlls from the connector installation folder and making some changes to the app.config 我已经经历过很多次了,但始终可以通过使用连接器安装文件夹中的dll并对app.config进行一些更改来修复它

However I can not get it to work this way now. 但是,我现在无法使其以这种方式工作。 I have no idea what to try next... I am using MYSQL 8.0.12 我不知道下一步该怎么做...我正在使用MYSQL 8.0.12

This is my app.config 这是我的app.config

<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <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>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-8.0.12.0" newVersion="8.0.12.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

Not sure if this is still solved are not. 不知道这是否仍然没有解决。 However, the below solution might be helpful for someone who is struggling. 但是,下面的解决方案可能对正在苦苦挣扎的人有所帮助。

It doesn't matter if you have installed any version of connector as it is not being automatically referenced in VS 2017. Only thing that matters is "MySQL for Visual Studio". 没关系安装任何版本的连接器都没关系,因为在VS 2017中不会自动引用该连接器。唯一重要的是“ MySQL for Visual Studio”。

  1. Install "MySQL for visual studio" (preferably any latest version 1.2.8 or 2.0.5) In case you face any issue while trying to install 2.0.5 please follow this link : https://forums.mysql.com/read.php?174,664930,664971 安装“ MySQL for visual studio” (最好是任何最新版本1.2.8或2.0.5),如果您在尝试安装2.0.5时遇到任何问题,请遵循以下链接: https : //forums.mysql.com/read。 php?174,664930,664971

  2. Inside your project, Add Nuget References to " MySQL.Data.EntityFrameWork " (V 8.0.13 or higher) 在您的项目中,将Nuget引用添加到“ MySQL.Data.EntityFrameWork ”(V 8.0.13或更高版本)

It will by default create the below App.Config file 默认情况下,它将创建以下App.Config文件

 <?xml version="1.0" encoding="utf-8"?> <configuration> <configSections> <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> </configSections> <entityFramework> <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework"> <parameters> <parameter value="mssqllocaldb" /> </parameters> </defaultConnectionFactory> <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.EntityFramework, Version=8.0.13.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"> </provider></providers> </entityFramework> </configuration> 

And there you go.. It should work fine. 然后就可以了。它应该可以正常工作。 I have spent more than 2 days, searching the entire google (almost) to figure that all the references/directions/suggestions were all pointing out " MySql.Data.Entity.EF6 ".. While all the while it is "MySql.Data.EntityFramework" that works fine with VS 2017 我花了2天多的时间,(几乎)搜索了整个Google,以发现所有的引用/方向/建议都指出了“ MySql.Data.Entity.EF6 ”。尽管它始终是“ MySql.Data” .EntityFramework“与VS 2017搭配使用时效果很好

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 VS2017 没有使用实体框架显示带有视图的 MVC 控制器 - VS2017 not showing MVC Controller with view using Entity Framework 如何在VS2017中为Entity Framework添加Oracle提供程序? - How to add Oracle provider in VS2017 for Entity Framework? VS2017和实体框架Core 2.0中的自定义执行策略错误 - Custom Execution Strategy Error in VS2017 and Entity framework Core 2.0 VS 2017中的MySQL和MVC实体框架无法正常工作 - MySQL and MVC Entity Framework in VS 2017 Not Working 建立解决方案时VS2017 Project回退框架错误 - VS2017 Project fallback framework error when building solution 在Entity Framework中,如何从VS2017中的不同Oracle模式生成实体 - In Entity Framework, how to generate entities from different Oracle schemas in VS2017 实体框架。 混淆DbProviderFactory - Entity Framework. Confuses DbProviderFactory 实体框架的读/写方法约定。 控制器vs DbContext? - Convention for read/write methods with Entity Framework. Controller vs DbContext? GroupJoin 在实体框架中引发错误。 加入工作正常 - GroupJoin is throwing an error in Entity Framework. Join is working fine 实体框架。 ExecuteStoreQuery将数据类型varchar转换为实数时出错 - Entity Framework. ExecuteStoreQuery Error converting data type varchar to real
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM