I created a new simple net5.0 + EFCore project, but after trying to run dotnet ef update --project DAL
I am getting an obscure error:
>dotnet ef update --project DAL
...
It was not possible to find any compatible framework version
The framework 'Microsoft.NETCore.App', version '2.0.0' was not found.
- The following frameworks were found:
3.1.12 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
5.0.3 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
...
Even though, I am not using the .NETCore 2.0.0
in the specified project, but rather the net5.0
as shown in the DAL.csproj
:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.5" />
</ItemGroup>
</Project>
I also tried to run the update with --framework net5.0
, but with no difference.
What setting am I missing to convince dotnet ef
to use correct framework.
(BTW. I am using the Rider, not VS), but I do not thing this matters.
I was in the exactly same situation as you and solved my problem by adding the Microsoft.EntityFrameworkCore.Design
package to the project.