How to unapply a migration in ASP.NET Core with EF Core

前端 未结 16 2277
余生分开走
余生分开走 2020-12-07 08:10

When I run PM> Remove-Migration -context BloggingContext in VS2015 with an ASP.NET Core project using EF Core I get the following error:

Syst         


        
16条回答
  •  再見小時候
    2020-12-07 08:51

    In general if you are using the Package Manager Console the right way to remove a specific Migration is by referencing the name of the migration

    Update-Database -Migration {Name of Migration} -Context {context}
    

    Another way to remove the last migration you have applied according to the docs is by using the command:

    dotnet ef migrations remove
    

    This command should be executed from the developer command prompt (how to open command prompt) inside your solution directory.

    For example if your application is inside name "Application" and is in the folder c:\Projects. Then your path should be:

    C:\Projects\Application
    

提交回复
热议问题