Entity framework - "dotnet ef migrations" returns "The framework 'Microsoft.NETCore.App', version '2.0.0' (x64) was not found." error

When calling dotnet ef migrations add you might experience the following the error:

It was not possible to find any compatible framework version
The framework 'Microsoft.NETCore.App', version '2.0.0' (x64) was not found.
  - The following frameworks were found:
      3.1.18 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      5.0.9 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      6.0.1 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

If you see this error you are likely missing the package "Microsoft.EntityFrameworkCore.Design". Install it by managing nuget packages or running install-package Microsoft.EntityFrameworkCore.Design. After this you should be able to do the dotnet ef migration without any issues.

If not check the version of Entity Framework tools you use, using dotnet ef. You can update these using the dotnet tool update --global dotnet-ef command.

I hope it helps like it helped me! Feel free to leave a comment down below.