0

我已经安装了 Visual Code 2022 预览版(17.1)。我在https://docs.microsoft.com/en-us/ef/core/get-started/overview/first-app?tabs=netcore-cli之后创建了一个简单的控制台应用程序

当我尝试添加迁移时,出现以下错误

> dotnet ef migrations add One
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:
      5.0.8 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:
  - https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=2.0.0&arch=x64&rid=win10-x64

为什么要 dot net 2.0?

4

1 回答 1

0

将包 Microsoft.EntityFrameworkCore.Design 添加到您的主项目中。如果这不起作用,请添加到您的数据访问层(项目)。

于 2021-12-29T12:38:27.583 回答