简体   繁体   中英

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

I'm new to the asp.net core and I'm developing an MVC App. I encountered an error trying to view entity framework migrations.

PMC command:

PM> get-migrations

Respond:

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

I cant figure out what is wrong. My guess is that perhaps my dotnet framework is corrupted or something

I tried:

  • reinstalling the VS2019
  • deleting entityframeworkcore sdk folders and running dotnet restore command
  • previously I fixed same error for the nuget command by identifying that nuget.exe was missing, downloading it and seting PATH to it (I hope You know what I mean)
  • reinstalling the Microsoft.AspNetCore.App packege

Nothing helped

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>

And the thing is that this same error occurs on other projects as well.

get-migrations is not available as command in the Package Manager Console, see Entity Framework Core tools reference - Package Manager Console in Visual Studio for a list of available commands.

You could use the CLI tools , which provide the dotnet ef migrations list command, or inspect the generated files in the Migrations directory manually.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM