PMC Error: The term 'get-mgrations' is not recognized as the name of a cmdlet

PMC Error: The term 'get-mgrations' is not recognized as the name of a cmdlet

我是 asp.net 核心的新手,我正在开发 MVC 应用程序。我在尝试查看 entity framework 迁移时遇到错误。

PMC 命令:

PM> get-migrations

回复:

get-mgrations : The term 'get-mgrations' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is 
correct and try again.
At line:1 char:1
+ get-mgrations
+ ~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (get-mgrations:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

我不知道哪里出了问题。我的猜测是,也许我的 dotnet 框架已损坏或其他原因

我试过了:

没有任何帮助

AdMarket.csproj:

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

  <PropertyGroup>
    <TargetFramework>netcoreapp2.2</TargetFramework>
    <UserSecretsId>aspnet-AdMarket-C5C71703-513A-471A-959E-3C883B2380D5</UserSecretsId>
    <AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.App" Version="2.2.7" />
    <PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
    <PackageReference Include="MySql.Data.EntityFrameworkCore" Version="8.0.17" />
  </ItemGroup>

  <ItemGroup>
    <Folder Include="Areas\Identity\Services\" />
  </ItemGroup>

</Project>

问题是,同样的错误也发生在其他项目上。

get-migrations 在程序包管理器控制台中不可用作命令,请参阅 Entity Framework Core tools reference - Package Manager Console in Visual Studio 以获取可用命令列表。

您可以手动使用 CLI tools, which provide the dotnet ef migrations list command, or inspect the generated files in the Migrations 目录。