Vuk Isic
Vuk Isic

Reputation: 53

EF Core migrations with Aspire

I have project structure like this:

EFPlayground
- EFPlayground (API project)
- EFPlayground.AppHost (Aspire app host project)

My DbContext is located in the EFPlayground project.

Running the project is ok, but adding new a migration/removing existing migration won't work with commands:

dotnet ef migrations add InitialCreate --project EFPlayground 
       --startup-project EFPlayground.AppHost


dotnet ef migrations remove --project EFPlayground 
       --startup-project EFPlayground.AppHost

I get this error:

C:\Users\y\source\repos\EFPlayground\EFPlayground.AppHost\bin\Debug\net9.0\EFPlayground.dll' not found.

EFPlayground.AppHost has a reference to the EFPlayground API project.

Also, I'm running dotnet build every time before I am executing dotnet ef migrations. Also because I am using VS I tried to build the solution with VS and terminal.

Am I missing something? I was unable to find any good documentation for working with .NET Aspire, EF Core and migrations. It would be good if someone have good documentation for this.

Upvotes: 0

Views: 71

Answers (0)

Related Questions