5

Recently Xamarin announced support for NetStandard (see https://releases.xamarin.com/stable-release-cycle-7-service-release-1/) and the recently shipped Entity Framework Core supports NetStandard. There was a recent issue with the SQLite.Native package that has been resolved (see https://github.com/aspnet/EntityFramework/issues/4269) but when I build the Android version of a Xamarin Forms application it appears it does not include all the assemblies in the output that are needed by the Entity Framework and therefore the application will not run and crashes on the first line of EF code to retrieve data. The UWP version appears to work just fine so this seems like an issue with Android (possibly iOS too).

Has anyone run into this and know a way around it so that the compiled Xamarin Forms Android application will run using Entity Framework Core to access a SQLite database?

Thank you in advance.

Athari
  • 33,702
  • 16
  • 105
  • 146
wjvii
  • 71
  • 1
  • 4
  • EF Core does not support NetStandard in 1.0: https://www.nuget.org/packages/Microsoft.EntityFrameworkCore.Tools/1.0.0-preview2-final. It supports `netcore50` which is UWP. The `netstandard13` support was added two weeks ago: https://github.com/aspnet/EntityFramework/blob/9cc12d67a3c1442ea979f1775d8a1322e524219b/src/Microsoft.EntityFrameworkCore.Design/project.json. – Mikhail Orlov Aug 23 '16 at 14:14
  • It is true that the tooling doesn't say NetStandard but EF Core itself does: https://www.nuget.org/packages/Microsoft.EntityFrameworkCore/ and states that it is NetStandard 1.3 compatible and since Xamarin states it is NetStandard 1.6 compatible it should work if my understanding of NetStandard is correct. – wjvii Aug 23 '16 at 15:10
  • Oh, I missed that, thanks! I don't know the answer. Maybe you should look in the direction of specifying "runtimes" and building specifically for them? Like in https://learn.microsoft.com/en-us/dotnet/articles/core/deploying/index? – Mikhail Orlov Aug 24 '16 at 10:25
  • I believe there's still some kinks in the `netstandard` implementation: https://github.com/aspnet/EntityFramework/issues/4269#issuecomment-243288275 – Jon Douglas Sep 13 '16 at 15:50

2 Answers2

0

Here are the steps you can follow.

  • Create a Xamarin.Forms project.
  • Convert the PCL project's properties to .NET Standard 1.3 enter image description here
  • Install Entity Framework Core and other EF Core stuffs

I have prepared a small hello world project at Github Here.

Foyzul Karim
  • 4,252
  • 5
  • 47
  • 70
0

need to use -linkskip to inform compiler not to remove references.

Geniuslead
  • 99
  • 1
  • 5