I am trying to add a migration in another project and I am literally getting white hair here trying different solutions found everywhere and none work, I just don't understand why isn't working.
I have this in Startup.cs
services.AddDbContext<ApplicationDbContext>(
c => c.UseSqlServer(_config.GetConnectionString("ApplicationDbContext"),
opt => opt.MigrationsAssembly("DatabaseContext.Migrations")));
I did check this, this, this and I think a few others, I don't know whats wrong.
For my solution structure is the following:
Shop (former empty solution)
1. DatabaseSchema (folder with empty spaces)
DatabaseContext (project with the migrations folder inside)
..
bunch of other stuff
..
ShopApi (here I have that code above in Startup.cs)
I tried:
dotnet ef migrations add ExampleMigration -s ../ShopAPI dotnet ef migrations script --project DatabaseContext --startup-project ../ShopAPI
It simply says there is no project found, I don't understand whats wrong with the path, I go one folder up and the project is right there. As it gets extremely annoying and on my nerves I tried all combinations of paths and still not finding anything.
The path is like this:
Shop (Solution) -> 1. DatabaseSchema (Folder) -> DatabaseContext/Migrations
-> ShopAPI (is where I have my Startup.cs)
What I don't understand here?