I've just installed .NET 6 SDK and updated all my projects to use target net6.0
, but when I try to create a new migration with the dotnet
tool I get:
.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<ApplicationIcon>assets-logo.ico</ApplicationIcon>
<RootNamespace>LC.Assets</RootNamespace>
<Authors>Stein Lundbeck</Authors>
<Company>Lundbeck Consulting</Company>
<Product>LC Assets</Product>
<Copyright>2021</Copyright>
</PropertyGroup>
<ItemGroup>
<Content Include="assets-logo.ico" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LC.Components.Core\LC.Components.Core.csproj" />
<ProjectReference Include="..\LC.Components\LC.Components.csproj" />
</ItemGroup>
</Project>
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:
6.0.0 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]You can resolve the problem by installing the specified framework and/or SDK.
I've updated the dotnet-ef
tool to version 6.0.0, so I don't know what it is that still target the 2.0.0 version.
Tool 'dotnet-ef' was successfully updated from version '5.0.4' to version '6.0.0'.
Any ideas?
CodePudding user response:
I had this problem recently after upgrading to .NET6.
The solution for me was to follow the link in the error message and install Microsoft.NETCore.App 2.0.0.
https://dotnet.microsoft.com/download/dotnet/2.0/runtime
I'm guessing that the upgrade to 6 removed this framework as it is considered legacy ... BUT ... is still used (or marked as a required dependency somehow) in the dot net tools.