Skip to content

Bundle-Migration "failed to restore project" or "it was not possible to find any compatible framework version" #27317

@StephanBis

Description

@StephanBis

We're trying to get the Bundle-Migration to work so we can integrate migrations in our CI/CD pipelines. We are however facing some issues.

When using the dotnet CLI, we're getting the following 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.22 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

When using the Package Manager Console Bundle-Migration command

Failed to restore xxx.csproj (in 2,51 sec).
Failed to restore xxx.csproj (in 2,51 sec).
Restored xxx.csproj (in 2,51 sec).
Restored xxx.csproj (in 2,51 sec).
Restored xxx.csproj (in 2,51 sec).
Restored C:\Users\xxx\AppData\Local\Temp\zbp3cxwh.dds\efbundle.csproj (in 2,69 sec).
Microsoft.EntityFrameworkCore.Tools.CommandException: Build failed. Use --verbose to see errors.
   at Microsoft.EntityFrameworkCore.Tools.Commands.MigrationsBundleCommand.Execute(String[] args)
   at Microsoft.EntityFrameworkCore.Tools.Commands.CommandBase.<>c__DisplayClass0_0.<Configure>b__0(String[] args)
   at Microsoft.DotNet.Cli.CommandLine.CommandLineApplication.Execute(String[] args)
   at Microsoft.EntityFrameworkCore.Tools.Program.Main(String[] args)

We do not understand why the dotnet CLI is complaining about .NET Core 2.0.0 as we are not referencing any packages that require this framework.
On the other hand our projects restore and build just fine, no issues. So we also do not quite understand why ef-tools cannot restore some projects.

Versions:

  • VS2022 on Windows 11
  • All projects are .NET 6
  • NuGet packages are up-to-date (v6.0.1)

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions