I have .net Core 3.1 solution with WebApi and Persistance projects. WebApi is the solution's startup project, Persistance is where DbContext is defined. After a lot of reading and trying stuff, I still cannot achieve the following:
WebApistays as the solution's startup project.Migrationsfolder with all the migrations classes is in thePersistanceproject.- Migrations can be generated from VS Package Manager Console by typing
Add-Migration <migration_name>without any additional parameters like-Projector-StartupProject. - No need to change selection in the Package Manager Console
Default projectdropdown.
I wanted to achieve the same result but on MAC OS. Because Visual Studio on Mac is not like Window's, We use CLI commands. In my case I had Migration Classes in another project and startup was Api project just like you so i added this to my terminal :
and you can call this simply by typing
migrationfortest "YOURMIGRATIONNAME"NOTE : For CLI command tools you should add This