How to use Entity Framework Core migrations in ASP.NET Core project.
SolutionThis is a continuation of the previous post on creating CRUD with ASP.NET Core and EF Core.
To utilize the EF migrations, add NuGet package to ASP.NET Core Web Application project: Microsoft.EntityFrameworkCore.Design
Add CLI tools by editing .csproj file.
- <ItemGroup>
- <DotNetCliToolReference
- Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.0" />
- </ItemGroup>
Here is a list of .NET CLI commands relating to EF migrations.

NOTE
You’ll need to run CLI commands from within ASP.NET Core Web Application project, however, point to the project containingDbContext and Entities using -p option (for add and remove commands).
Below are the examples of most commonly used commands.
To add migration -




Join the conversation! Your thoughts help the community grow.