"Unable to cast object of type 'ConcreteTypeMapping' to type 'Microsoft.EntityFrameworkCore.Storage.RelationalTypeMapping" WebApi on macos

As per https://github.com/aspnet/EntityFrameworkCore/issues/11704 you have a version mismatch.

Some of your Entity Framework versions are referencing 2.1 while some are referencing 2.0.

You need to change them all to reference version 2.1.

You should open up all of the csproj files and search for 2.0 and 2.1.


It's a version mismatch problem. Just update all reference version 2.0 to 2.1.

  • Microsoft.AspNetCore.All --version 2.1.0
  • Microsoft.EntityFrameworkCore --version 2.1.0
  • Microsoft.NETCore.App --version 2.1.0

Hopefully changing these references, it will work.


I got exactly the same issue like you. In my case, I referenced directly the Microsoft.EntityFramework.Design to the Visual C# project file (.csproj) by adding this to the Package Manager Console :

Install-Package Microsoft.EntityFrameworkCore.Design

In the described error i got, the Microsoft.EntityFrameworkCore.Design is thrown and I thought to add it. So it runs now.