#SharePointProblems | Koskila.net

Solutions are worthless unless shared! Antti K. Koskela's Personal Professional Blog

How to resolve persistent "Build started... Build failed." when trying to run Entity Framework Core commands?

koskila
Reading Time 4 min
Word Count 580 words
Comments 10 comments
Rating 4.8 (6 votes)
View

This time, I'm happy to present you perhaps the simplest way of fixing an annoying and persistent issue with a misleading error message! Wait, does that sound familiar? It's almost like that's what half of my articles are about...

Anyway, I was happily going my way about creating a couple of new fields to an entity and then scaffolding my changes to a new migration using Entity Framework Core's Add-Migration, but this happened:

Build started...
Build failed.

"Oh", I thought. "I must have messed something up and the build is broken."

Well, I hit Ctrl+Shift+B, and build passed just fine.

Wait, what now?

AI-powered summary: Quick Fix for Entity Framework Core Build Errors

  1. Encounter a 'Build started... Build failed' error with Entity Framework Core commands? The issue often lies not with your main project but with another project in the solution that may be broken. Ensure all projects build correctly to run EF Core commandlets successfully. Solutions include:
  • Checking the build status of all projects

  • Resolving any build issues in auxiliary projects

  • Re-running EF Core commands after fixes

Problem

My project was building, debugging, rebuilding etc. just fine, but failed to run Add-Migration, or Remove-Migration (or Update-Database for that matter)!

What in tarnation

Below is what it looked like in the Package Manager Console:

"Build started", "Build failed" in Entity Framework's Add-Migration

"Build started", "Build failed" in Entity Framework's Add-Migration

As you can see, specifying -Verbose make any difference. My normal first go-to, making sure the Default project is the correct one, selecting the right startup project in Visual Studio's Solution Explorer, and even specifying -Context and -Project made no change whatsoever.

In addition to running into this with the CommandLets (Add-Migration and such), you will run into the same issue if you try to use any dotnet ef migrations commands, like:

dotnet ef migrations add InitialMigrationdotnet ef migrations removedotnet ef database update

So, what gives?

Solution

Okay, so once again, this is going to be a bit stupid! But that's the way I like to bang my head on the keyboard, so let's get to it.

Time needed: 5 minutes.

How to fix "Build started... Build failed." when running EF Core commands?

  1. Verify your projects build successfully

    Literally - go through each of the projects in your solution and make sure they can be built.

  2. Option 1: Fix your projects

    If you find a project that fails to build, most of the time you'll want to fix it. There could be a lot of reasons why your build fails, so I won't be able to cover them here.

    But if you can't, or don't want to fix a project (one that's not actually required to run your project), you might want to take a look at Option 2 below...

  3. Option 2: Unload your projects if you don't want to fix it

    If your unbuildable project isn't that important (at least in the moment), just unload it.

    Unload a project in Visual Studio Solution Explorer

For me, it was another project that was just a bit broken and wouldn't build - that caused me no issues with my normal development workflow (it was a tooling project only occasionally used, and somehow, somewhere along the line, someone broke it), but Entity Framework Core commandlets require all of the projects to be kosher in order to run successfully.

So, that solved it for me. Let me know whether it helped you or not! :)

References

A couple of links I've found useful:

Comments

Interactive comments not implemented yet. Showing legacy comments migrated from WordPress.
Ben Junior
2021-07-31 19:47:27)
Yes, that was exactly what happened to me. Thanks so much.
2021-08-12 22:36:15
Cheers, Ben - happy to hear it was helpful! 😊
Dmitry
2022-03-31 11:19:21)
Thank you for the explanation. I hit the same problem. It's too much from Microsoft to require ALL projects to be in 'kosher' state (nice use of the word, ha-ha). I solved the issue by using dotnet ef command
Antti K. Koskela
2022-03-31 12:08:42
Thanks for your comment, Dmitry! I agree, it's not a feasible requirement, but I definitely don't think it was intentional by Microsoft 😅 I guess 'dotnet ef' doesn't have that requirement? I didn't give it a try back then - maybe I should've!
Romario
2022-08-30 16:51:56)
THANKS for taking the time to help. this worked for me
2022-09-27 16:16:07
Hi Romario, Thanks for your comment, super happy to hear it was helpful!
Angel Bello
2022-10-11 04:51:03)
Thanks man, that was exactly the solution.
2022-10-17 22:44:19
Hi Angel, Super, happy to hear it helped! -A
Bedirhan Çakır
2023-01-06 10:18:17)
You are a savior!!!!!
Antti K. Koskela
2023-02-27 20:08:47
Happy to be of help! 😄
Whitewater Magpie Ltd.
© 2025
Static Site Generation timestamp: 2025-08-12T07:18:35Z