Update-Database throwing “Could not load file or assembly <Project.Tests> .. or one of its dependencies” error

This is another of those frustratingly simple issues to resolve — or at least it was in my case. I had a solution with two projects in it. One with code and one with tests. I had made some updates to my data model and wanted to update the database. During this I noticed that my tests project had somehow become the startup project. I’ve no idea how this happened as it’s not something I ever recall doing deliberately.

Before I ran the update-database command I set my code project to be the startup project. When I did this I got the error above, which initially confused me as the test project wasn’ t the startup one. The issue appears to be that my package manager console was already open when I made the change, starting a new package manager console resolved this issue for me.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Steve Ellwood

Senior Integrations Officer at Doncaster Council Any views expressed are entirely my own.