Version Conflict detected for Microsoft.EntityFrameworkCore.Install

I am getting the following error when adding an asp.net core api to an existing project I am working on.

"Version Conflict detected for Microsoft.EntityFrameworkCore.Install/reference Microsoft.EntityFrameworkCore 2.2.1 directly to project to resolve this issue"

I tried to add the Nuget package but get further version conflicts across a number of different packages and the process always fails. At first I thought this may be an issue with my project so I started a new solution from scratch and managed to replicate the issue with a few simple steps.

  1. Create a new solution (EFDemo)
  2. Add a new .net Core class library to the solution called EFDemo.BL
  3. Add the following Nuget packages to project EFDemo.BL (as I'm using an existing database for my new project)
  4. Microsoft.EntityFrameworkCore.SqlServer (v2.2.1)
  5. Microsoft.EntityFraneworkCore.Tools (v2.2.1)
  6. Add a new .net core web application called EFDemo.Api and select the API project template.
  7. Add a reference from EFDemo.BL to EFDemo.Api.
  8. Build and see the failure.

I have reviewed the following post but its solution does not work for me as I have no reference to "Microsoft.EntityFrameworkCore" in any of my csproj files. Version conflict detected for NuGet packages.

I have also reinstalled .net SDK, rebooted a million times and still can't understand what the issue is.

I have encountered the same error recently.

What I have done to sort this out:

Installed .Net Core 2.2 SDK

Then in my project I have changed in all .csproj files:

  <PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>

whereas before it was:

      <PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>

This helped straight away and the error dissapeared.

Version conflict detected when installing EF 2.1.1 on ASP Core 2.1 , Version conflict detected for Microsoft.EntityFrameworkCore.Abstractions. Reference the package directly from the project to resolve this issue. Error NU1107 Version conflict detected for Microsoft.EntityFrameworkCore. Install/reference while installing EF core

Error NU1107 Version conflict detected for Microsoft , You have to select 2.2.0 version when installing the Microsoft.​EntityFrameworkCore.SqlServer package. In Manage Nuget Packages window. NU1107 Version conflict detected for Microsoft.AspNetCore.Razor.Language. Install / reference Microsoft.AspNetCore.Razor.Language 2.2.0 directly to project [projectname] to resolve this issue.

For me, it helped this article, it was a very simple change on the configuration, which I forgot to change:

<PropertyGroup>
  <TargetFramework>netcoreapp2.2</TargetFramework>
</PropertyGroup>

https://dotnetcoretutorials.com/2018/11/18/how-to-target-net-core-2-2/

Unable to Install Microsoft.EntityFrameworkCore in ASP.NET Core , I had the same problem and I just installed EFCore 2.1.11. It seems that EFCore and AspNetCore go side by side in versions. dotnet add package Microsoft.EntityFrameworkCore.Abstractions --version 3.1.5 <PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="3.1.5" /> For projects that support PackageReference , copy this XML node into the project file to reference the package.

I am not sure what package you have installed in your project.

But now days visual studio add just one nuget packages which includes all of required package for asp.net core application.

Try installing this package and remove all other package and see it that works for you.

Microsoft.AspNetCore.All

This way you will not have version conflict at least within Microsoft packages. You can then verify other external package that you might have installed which is causing problem.

Resolving the Version conflicts for a downgraded .NET Core 2.1/2.2 , Install/reference [package] 2.2.0 directly to project [projectname] to resolve this issue." NU1107 Version conflict detected for Microsoft.AspNetCore.Razor.​Language. EntityFrameworkCore 2.2.0 -> Microsoft.VisualStudio. All NuGet packages (not just ours, but the entire world) which share a dependency with Microsoft.AspNetCore.App cannot not reference versions of those dependencies higher than the default implicit Microsoft.AspNetCore.App version without introducing a version conflict. When a version conflict exists, the following errors will often occur.

I fixed this just installing .NET Core 2.2 and changing TargetFramework tag to netcoreapp2.

<PropertyGroup>
  <TargetFramework>netcoreapp2.2</TargetFramework>
</PropertyGroup>

NuGet Error NU1107, Version conflict detected for 'PackageA'. Install/reference 'PackageA' v4.0.0 directly to resolve this issue. 'PackageB' 3.5.0 -> 'PackageA'  NU1107: Version conflict detected for Xamarin.Android.Support.Compat. Reference the package directly from the project to resolve this issue.

Microsoft.EntityFrameworkCore 3.1.5, Requires NuGet 3.6 or higher. Package Manager .NET CLI; PackageReference; Paket CLI. Install-Package Microsoft.EntityFrameworkCore -Version 3.1. Entity Framework Core is a lightweight and extensible version of the popular Entity Framework data access technology. Commonly Used Types: Microsoft.EntityFrameworkCore.DbContext Microsoft.EntityFrameworkCore.DbSet

Microsoft.EntityFrameworkCore 2.2.0-preview1-35029, Entity Framework Core is a lightweight and extensible version of the This is a prerelease version of Microsoft. Install-Package Microsoft. To specify a specific version, use the -Version modifier. For example, to install EF Core 2.2.0 packages, append -Version 2.2.0 to the commands. For more information, see Package Manager Console. Get the Entity Framework Core tools

What is the correct way to install dependencies for using Postgres , csproj : error NU1107: Version conflict detected for Microsoft.​EntityFrameworkCore. Install/reference Microsoft.EntityFrameworkCore 2.2.0 directly to project  NU1107: Version conflict detected for Microsoft.EntityFrameworkCore.Abstractions. Install/reference Microsoft.EntityFrameworkCore.Abstractions 2.2.1 directly to project WebApplication1 to resolve this issue.

Comments
  • Yes this helped thanks, Also after installing .NET Core 2.2 and changing the TargetFramework to 2.2 i also had to change my WebAPI project "Microsoft.AspNetCore.App" To version "2.2.5"
  • For me, I just had to install the new SDK (2.2) and delete the old (2.1)
  • And for me, was trying to install Microsoft.EntityFrameworkCore.SqlServer 2.2.6 with no joy with a web api. I had an error when I changed in the properties to 2.2, so just created a new web api app with 2.2 and installed Microsoft.EntityFrameworkCore.SqlServer and it installed no problem. Not sure if I need anything else though.
  • Unfortunately this did not work for me but thanks for the suggestion!
  • The package brings in a large number of dependencies which can all conflict. For example, my version depends on EntityFrameworkCore >=2.1.1 && < 2.2.0