My WPF program is using Entity Framewok Core 3.1.1 (code-first) with a SQLite database. If the database file does not exist on startup, the program calls context.Database.Migrate()
to create one. Works great.
When I added Costura.Fody (using NuGet), that huge collection of DLLs disappeared and the program still works - until it needs to create a new database file. Then the Migrate()
function fails with an error:
The type initializer for 'Microsoft.Data.Sqlite.SqliteConnection' threw an exception - The path is not of a legal form.
I have a similar issue if I try to use the Package Manager Console to add a migration manually - I get
Your startup project doesn't reference Microsoft.EntityFrameworkCore.Design
Removing the Fody Costura package causes everything to start working again. I haven't found anything on SO or elsewhere that references this issue, and Fody seems to be very popular, so I must be doing something dumb, but I don't know where to look.
Does anyone know how to get Fody Costura and EF Core migrations to coexist?
Many thanks.