Migration not working
The answer to the error Startup project 'docker-compose' is a Docker project. Select an ASP.NET Core Web Application as your startup project and try again.
Was to right click my actual code project in VisualStudio and click Set as Startup Project.
The solution file had marked the docker-compose project as the default project.
Add-Migration
has optional parameters -StartupProject
and -Project
.
These allow you to specify alternatives to the solutions configured Startup Project and the currently selected project in Package Manager/Console
If the project you want the migrations to be created in is not actually your Startup project then using these parameters means you do not have to constantly change your solutions configuration every time you want to run a migration.
So the command would look like:
Add-Migration InitialCreate -StartupProject MyProjectName -Project MyProjectName
Another cause to:
Startup project 'docker-compose' is a Docker project. Select anASP.NET Core Web Application as your startup project and try again.
can also be that your context is missing expected constructor signatures. You need those:
public SomeContext(DbContextOptions options) : base(options){}public SomeContext(){}