Microsoft EntityFrameWork Core 2.2.0 Issue Or Not :)

I found myself encountered this issue lately when trying to upgrade my bootstrap project for Clean lean Architecture via TDD approach (GitHub link here). 

What was the issue ?

  • When adding Microsoft.EntityFrameworkCore via NuGet in VS2018, the default version is 2.2.0 as following
  • The default webapi created from VS2018 or dotnet core cmd uses Microsot.AspNetCore.App version 2.1.1 which is compatible with entity framework version 2.1.x and below. 

How did I resolve it?

Approach 1: manually update the infrastructure project to use Microsoft.EntityFramework version 2.1.0 

  • To do this, we have to manually override the version in the project property file. 
  • Then run dotnet restore from cmd to update the library to expected version


Approach 2: Upgrade the default library of api project to latest version which is compatible with Microsoft.EntityFramework version 2.2.0 

  • Remove Microsoft.AspNetCore v2.1.0
  • Add from Nuget the latest version of 2.2.0 for both AspNetCore and AspNetCore.Mvc

Approach 3: Update DotNet Core to v2.2.0 which should be the easiest approach I would recommend to undertake. 

  • Make sure that you have it updated with latest version of VS2018 as well.

Hope it helps to avoid some wasted time. 

Until we meet again, happy coding.