DotNetCore 3 EF Core 3 CLI is looking for AspNetCore.App version '2.2.0'

asp.net-core asp.net-core-3.1 c# entity-framework entity-framework-core

Question

I had EF Core set up and working with .Net Core 2 & EF Core 2. I upgraded to .Net Core & EF Core to v3 but I never tested my migrations.

Now I have upgraded to .NetCore 3.1 & EF Core 3.1 and when I try to create a migration or run database update I get the following error.

It was not possible to find any compatible framework version
The framework 'Microsoft.AspNetCore.App', version '2.2.0' was not found.
- The following frameworks were found:
  3.0.1 at [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  3.1.3 at [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]

You can resolve the problem by installing the specified framework and/or SDK.

I have checked the version of dotnet

dotnet --version 
3.1.201
dotnet ef --version
Entity Framework Core .NET Command-line Tools 3.1.3

My Class library where EF Core is installed and the startup project both target

<PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>

And I have upgraded all my NuGet packages to the latest version.

Class Library

<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>

<ItemGroup>
  <Folder Include="Migrations" />
</ItemGroup>

<ItemGroup>
    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.3" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.3">
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
      <PrivateAssets>all</PrivateAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.3" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.3" />
</ItemGroup>

<ItemGroup>
  <ProjectReference Include="..\Event.Models\Event.Models.csproj" />
</ItemGroup>
</Project>

And my Startup Project

<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
    <DockerComposeProjectPath>../docker-compose.dcproj</DockerComposeProjectPath>
    <UserSecretsId>some-secret-guid</UserSecretsId>
</PropertyGroup>

<ItemGroup>
    <PackageReference Include="MassTransit" Version="6.2.3" />
    <PackageReference Include="MassTransit.AspNetCore" Version="6.2.3" />
    <PackageReference Include="MassTransit.Autofac" Version="6.2.3" />
    <PackageReference Include="Autofac" Version="5.1.2" />
    <PackageReference Include="Autofac.Extensions.DependencyInjection" Version="6.0.0" />
    <PackageReference Include="MassTransit.Extensions.DependencyInjection" Version="6.2.3" />
    <PackageReference Include="MassTransit.RabbitMQ" Version="6.2.3" />
    <PackageReference Include="Serilog" Version="2.9.0" />
    <PackageReference Include="Serilog.AspNetCore" Version="3.2.0" />
    <PackageReference Include="Serilog.Sinks.MongoDB" Version="4.0.0" />
</ItemGroup>

<ItemGroup>
  <ProjectReference Include="..\Event.DataAccess\Event.DataAccess.csproj" />
  <ProjectReference Include="..\Event.Domain\Event.Domain.csproj" />
  <ProjectReference Include="..\Event.Models\Event.Models.csproj" />
</ItemGroup>

</Project>

I have no idea where the reference to Microsoft.AspNetCore.App, version '2.2.0' is coming from. I have Googled this and I haven't come across any related issues.

Thanks in advance for any help.

1
0
3/26/2020 9:34:15 PM

Popular Answer

hi many time this problem happened to me, so first uninstall all of the NuGet packages from the all of your project and class library ( remember the name of packages you have been uninstalled) then install them again with the last version you want (be careful many packages in asp core 3 joined to gather or removed)

0
3/27/2020 9:56:53 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow