I\'m developing a project that will use ASP.NET Web API as the data service, and a Xamarin portable app as client.
I\'m trying to enable migrations in the web app, but I
It seems it's complaining about Using StartUp project 'MyProject.App'
but you have already specified the start up project name with -StartupProjectName MyProject.App
Can you try only:
Enable-Migrations -enableautomaticmigrations -ContextTypeName MyProject.Models.ApplicationDbContext -ProjectName MyProject -StartupProjectName MyProject.App -Verbose
Make sure that in your start up project config file you have a valid connection string (unless you specify a connection string name in the DbContext constructor, your connection string should be called ApplicationDbContext, like your DbContext, if I remember correctly)
UPDATE I underestimated the problem. It seems it might be not how you specify the start up project, but the start up project itself. I suggest looking at this answer. Pay special attention, as I was saying before, that the connection string exists in the web or app.config in the start up project and has the right name.
Well according to this (tested and works), the only way to enable migrations in aspnetcore+ef6 project, is to have the DbContext
impl in an external full .NET class library, plus adding a dummy start up project.
Sucks but works.