dotnet / dotnet/EntityFramework.Docs
Sample "TwoProjectMigrations" can't load assembly for migration
- Dominant language
- Mermaid
- Stars
- 1.7k
- Forks
- 2k
- Avg merge
- 7d 23h
- Merged PRs (30d)
- 16
Description
I was refactoring my application to support multiple DB providers in accordance with the "TwoProjectMigrations" sample, hitting a roadblock on actually using the migrations for migrating. Turns out I get the same error with the sample:
I hijacked the Worker.Execute() method to run a migration as follows:
```
using var scope = _services.CreateScope();
var services = scope.ServiceProvider;
var context = services.GetService();
context.Database.Migrate();
```
Resulting in this error:
`System.IO.FileNotFoundException: Could not load file or assembly 'SqlServerMigrations, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.`
Is this not the right approach?
Contributor guide
Assessment
This issue has not been assessed yet.