2
votes

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

1 Answers

2
votes

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

In Manage Nuget Packages window

enter image description here

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" />