As it stands now, the Migrations tooling prevents you from creating your DbContext and DbMigrationsConfiguration classes in different projects.
- Create Project1 with a DbContext in it (start-up project)
- Create Project2 with a DbMigrationsConfiguration that references Project1 (migrations project)
- Call Add-Migration
Could not load assembly 'Project2'. (If you are using Code First Migrations inside Visual Studio this can happen if the startUp project for your solution does not reference the project that contains your migrations. You can either change the startUp project
for your solution or use the -StartUpProjectName parameter.)
Because Project1 is the startup project, Migrations executes in its output directory. However, Project2.dll doesn't exist in that directory because the assembly reference goes from Project2 to Project1.
Ideally, we need a solution that can use Project1's configuration file and assembly resolution, but that can also resolve the Project2 assembly and all of its dependencies.