Skip to content
Latchkey

EF Core "Your startup project doesn't reference Microsoft.EntityFrameworkCore.Design" in CI

The dotnet ef tool needs the Microsoft.EntityFrameworkCore.Design package in the startup project to load design-time services. Without it, migrations and database commands stop before doing anything.

What this error means

A dotnet ef command fails with "Your startup project 'X' doesn't reference Microsoft.EntityFrameworkCore.Design. This package is required for the Entity Framework Core Tools to work."

.NET
Your startup project 'MyApp.Web' doesn't reference Microsoft.EntityFrameworkCore.Design.
This package is required for the Entity Framework Core Tools to work. Ensure your
startup project is correct, install the package, and try again.

Common causes

The Design package is not referenced

The startup project has no PackageReference to Microsoft.EntityFrameworkCore.Design, which the tools need to build the migration model.

The wrong startup project is targeted

The command runs against a class library or a project that lacks the Design reference instead of the web/host project that has it.

How to fix it

Add the Design package to the startup project

  1. Add a reference to Microsoft.EntityFrameworkCore.Design in the host/web project.
  2. Restore so the package is present before running dotnet ef.
  3. Re-run the migration command.
MyApp.Web.csproj
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.6">
  <PrivateAssets>all</PrivateAssets>
</PackageReference>

Point --startup-project at the right project

If the DbContext lives in a library, tell the tool which project is the startup project and which holds the context.

Terminal
dotnet ef migrations add Init \
  --project src/MyApp.Data \
  --startup-project src/MyApp.Web

How to prevent it

  • Reference Microsoft.EntityFrameworkCore.Design in the startup/host project.
  • Use --project and --startup-project explicitly when the context is in a library.
  • Keep the Design package version aligned with the EF Core runtime version.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →