You may want to store your migrations in a different project than the one containing your ApplicationDbContext. You can also use this strategy to maintain multiple sets of migrations, for example, one for development and another for release-to-release upgrades. I used Entity Framework core 5.0 and ASP.NET core Web Application 5.0

Steps

  1. Create a ASP.NET core web application, project name “Xaero”. Add another Class Library in same project name as “Xaero.DataLayer”
  2. Add a reference “Xaero.DataLayer” to “Xaero”.
  3. Move the migrations and model snapshot files to the class library.
  4. Configure the migrations assembly in “Xaero”. Goto ConfigureServices method in Startup.cs file
View of Startup.cs

--

--