'I can not create a new web API using Entity Framework in .NET Core 3.1.9

Hi im having problem to create a Web API Controller using EF, currently im using .Net Core 3.1.9 and im not ready to upgrade at .Net Core 5.0 but in the same time i cant generate a API Controller.

enter image description here

The Updates that appeared are like below enter image description here before that when this problem appeared i just updated the packages and it worked perfectly but now i cant update i want to keep it in v3.1.9 for the moment. Thank you in advance!



Solution 1:[1]

Finally, I got it working. I was getting the same error and here is how I fixed the issue.

  1. Goto obj folder and look for file "ProjectName.csproj.nuget.g.props" in my case it is: "PaymentDetailsWebAPI.csproj.nuget.g.props"

  2. Search for Project="$(NuGetPackageRoot)microsoft.entityframeworkcore.design you will get something like this:

    Project="$(NuGetPackageRoot)microsoft.entityframeworkcore.design\3.1.23\build\netcoreapp2.0\Microsoft.EntityFrameworkCore.Design.props"
    
  3. Now look for Nuget package version. In my case I got "3.1.23".

  4. Now update following packages to: whatever version you have in your file.

    Microsoft.EntityFrameworkCore Microsoft.EntityFrameworkCore.Design Microsoft.EntityFrameworkCore.SqlServer Microsoft.EntityFrameworkCore.Tools

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ethan McTague