Error NU1107 Version conflict detected for Microsoft.EntityFrameworkCore. Install/reference while installing EF core

房东的猫 提交于 2020-08-10 04:47:07

问题


I installed a visual studio 2017 and I have created a MVC project called WebApplication1.

In the Dependencies-> NuGet I have the files

  • Microsoft.AspNetCore.App(2.2.0)
  • Microsoft.AspNetCore.Razor.Design(2.2.0).

In Dependencies->SDK:

  • Microsoft.AspNetCore.App(2.2.0)
  • Microsoft.NETCore.App (2.2.0)

I want to install Entity Framework Core for my project.

Thus I right click on my project and select "Manage Nuget Packages" and then in brows section I enter "Microsoft.EntityFrameworkCore.SqlServer" in the serch bar and choose it then install. However the console shows me two errors for installing:

Severity Code Description Project File Line Suppression State Error Package restore failed. Rolling back package changes for 'WebApplication1'. Error NU1107 Version conflict detected for Microsoft.EntityFrameworkCore. Install/reference Microsoft.EntityFrameworkCore 3.1.1 directly to project WebApplication1 to resolve this issue. WebApplication1 -> Microsoft.EntityFrameworkCore.SqlServer 3.1.1 -> Microsoft.EntityFrameworkCore.Relational 3.1.1 -> Microsoft.EntityFrameworkCore (>= 3.1.1) WebApplication1 -> Microsoft.AspNetCore.App 2.2.0 -> Microsoft.EntityFrameworkCore (>= 2.2.0 && < 2.3.0). WebApplication1 F:\Div\workspace\CSDDashboard.net project\WebApplication1\WebApplication1\WebApplication1.csproj 1

I have searched a lot on the internet to find any solution but till now I'm not successful. I appreciate if anyone could solve the issue.


回答1:


You have to select 2.2.0 version when installing the Microsoft.EntityFrameworkCore.SqlServer package

In Manage Nuget Packages window

Or use Package Manager Console:

Install-Package Microsoft.EntityFrameworkCore.SqlServer -Version 2.2.0

or add this line to your csproj file

<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.0" />


来源:https://stackoverflow.com/questions/59825912/errornu1107version-conflict-detected-for-microsoft-entityframeworkcore-instal

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!