9
votes

I tried to use EFCore with SQLite in a Xamarin.Android project. I also added the package Microsoft.EntityFrameworkCore.Tools. When I try to create database migrations I get various errors.

When running dotnet ef migrations add migrationname on the command line I get the error

No executable found matching command "dotnet-ef"

When running Add-Migration migrationname in Package Manager Console I get error

Startup project 'MyProject' targets framework 'MonoAndroid'. The Entity Framework Core Package Manager Console Tools don't support this framework.

Is there some way around this? Do I have to use EF6 instead of

1

1 Answers

6
votes

The guidance for unsupported frameworks is to move your DbContext code into a .NET Standard class library and use a dummy .NET Core console app with the tools.

cd MyDbContextProject
dotnet ef migrations add MyMigration --startup-project ..\MyDummyProject