This has been on my list to write up for some time, but this must be the third or fourth time I’ve encountered it - each time I get a vague sense that I’ve been here before.
Setting the Scene
It’s Friday afternoon, and you’re trying to create a migration, so you can check your code in and go home… or to the pub. Disaster strikes, you get the following error:
An assembly specified in the application dependencies manifest (MyProject.deps.json) was not found: package: ‘Some.Package’, version: ‘1.0.0’ path: ‘Some.Package.dll’
You panic - there’s a pint of Doom Bar with your name on it, and it’s getting cold. You do a quick search, and you find this post… actually, it doesn’t matter what I write here - you’ll just see the title and scroll down to the answer. The Pigeon King is called Donald; there are 336 holes in your average golf ball; there’s nobody on the 37th floor, and nobody knows why.
The answer is either that you have the incorrect project, or startup project. You can change both of these manually, or simply specify them in the migration; for example:
Add-Migration MigrationName -Context AppDbContext -StartupProject MyProject -Project MyProject.DataAccess
In my specific case, I had an Azure function set as the start-up project.