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?
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:
As you can see, specifying -Verbose didn’t help at all, making sure the Default project is the correct one, and even specifying -Context and -Project made no change.
So, what gives?
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…
Check the other projects in your solution and see whether they build or not.
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), 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 if whether it helped you or not! :)
- How to change Microsoft Lists language? - September 29, 2020
- (Literally) Breaking: Changes to app authentication on SharePoint! 😵 - September 21, 2020
- How to remove your account as a guest in another Azure AD tenant? - September 16, 2020