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:
WebApi
stays as the solution's startup project.Migrations
folder with all the migrations classes is in thePersistance
project.- Migrations can be generated from VS Package Manager Console by typing
Add-Migration <migration_name>
without any additional parameters like-Project
or-StartupProject
. - No need to change selection in the Package Manager Console
Default project
dropdown.
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