Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package Manager Console Error with Multiple Startup Projects #26871

Open
SoftCircuits opened this issue Dec 1, 2021 · 5 comments
Open

Package Manager Console Error with Multiple Startup Projects #26871

SoftCircuits opened this issue Dec 1, 2021 · 5 comments
Labels
area-tools customer-reported punted-for-7.0 Originally planned for the EF Core 7.0 (EF7) release, but moved out due to resource constraints. type-bug
Milestone

Comments

@SoftCircuits
Copy link

SoftCircuits commented Dec 1, 2021

I recent upgraded all the projects in my solution from .NET 5.0 to .NET 6.0.

The solutions builds and runs without error.

But when I attempt to add a migration, I get an 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:
    5.0.12 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
    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.

The specified framework can be found at:

The problem, as it turns out, is that I have two projects set as the Startup Project: A client application and Web API application. If I set only the client application as the Startup Project, then the migration adds without error.

So I'm able to move forward but I do not understand the original error. Why is it looking for version 2 of Microsoft.NETCore.App? And why did upgrading to .NET 6.0 make this version no longer available? Is this a bug?

Include provider and version information

EF Core version:
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: .NET 6.0
Operating system: Windows 10
IDE: Visual Studio 2022 17.0.1

@ajcvickers
Copy link
Member

/cc @bricelam

@bricelam bricelam self-assigned this Dec 8, 2021
@ajcvickers ajcvickers added this to the 7.0.0 milestone Dec 9, 2021
@DavidDury
Copy link

I am facing similar issue except I am able to add new migration, update database and so on. What I am trying to do is generate a sql script for a migration.

  • multiple projects setup
  • migrations is in separate project.

PS C:\Users\dev\Desktop\web-solution\src> dotnet ef migrations script 0 Initial -c ApplicationDbContext -p ./Migrations/Migrations.csproj -o ./Migrations/Application/Scripts
Build started...
Build succeeded.
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.1 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

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

The specified framework can be found at:

C:\Program Files\Microsoft Visual Studio\2022\Enterprise>dotnet sdk check
.NET SDKs:
Version Status

6.0.101 Up to date.

.NET Runtimes:
Name Version Status

Microsoft.AspNetCore.App 6.0.1 Up to date.
Microsoft.NETCore.App 6.0.1 Up to date.
Microsoft.WindowsDesktop.App 6.0.1 Up to date.

The latest versions of .NET can be installed from https://aka.ms/dotnet-core-download. For more information about .NET lifecycles, see https://aka.ms/dotnet-core-support.

@alfkonee
Copy link

alfkonee commented Jan 4, 2022

I'm also facing the same issue as @DavidDury but I can't even add the migrations

  Tech231.SportPlus.Infrastructure   master ↓1  +1   6.0.101    dotnet ef migrations add AddGuidDefaults
Build started...
Build succeeded.
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.15 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      3.1.21 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      5.0.12 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      5.0.13 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      6.0.0-rc.1.21451.13 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      6.0.0 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      6.0.1 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

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

The specified framework can be found at:
  - https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=2.0.0&arch=x64&rid=win10-x64

@alfkonee
Copy link

alfkonee commented Jan 9, 2022

From FairyFox5700/Disaster-Tracker-App#2 I found that installing Microsoft.EntityFrameworkCore.Design Nuget in the Class LIB Project Fixed it
dotnet add package Microsoft.EntityFrameworkCore.Design

@bricelam
Copy link
Contributor

I suspect you'll get a better error after PR #27671

@ajcvickers ajcvickers added propose-punt punted-for-7.0 Originally planned for the EF Core 7.0 (EF7) release, but moved out due to resource constraints. and removed propose-punt labels Jul 6, 2022
@ajcvickers ajcvickers modified the milestones: 7.0.0, Backlog Jul 7, 2022
@bricelam bricelam removed their assignment Jul 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-tools customer-reported punted-for-7.0 Originally planned for the EF Core 7.0 (EF7) release, but moved out due to resource constraints. type-bug
Projects
None yet
Development

No branches or pull requests

5 participants