1
votes

Getting this Error In Xamarin Form Android Project I am refering Entity framework library int android project. Error as below

Severity Code Description Project File Line Suppression State Error Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Perhaps it doesn't exist in the Mono for Android profile? File name: 'EntityFramework.dll' at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters) at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(DirectoryAssemblyResolver resolver, ICollection1 assemblies, AssemblyDefinition assembly, Boolean topLevel) at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(DirectoryAssemblyResolver resolver, ICollection1 assemblies, AssemblyDefinition assembly, Boolean topLevel) at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(DirectoryAssemblyResolver resolver, ICollection`1 assemblies, AssemblyDefinition assembly, Boolean topLevel) at Xamarin.Android.Tasks.ResolveAssemblies.Execute(DirectoryAssemblyResolver resolver) RadLoc.Android C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets 1500

I am stuck here please help me out of this..

2
EF6 is not compatible with Xamarin/Android. Use EF Core. - magicandre1981
@magicandre1981 My EF ref in another C# Class Library and I am giving this C# library ref to my xamarin portable class library. and this Portable class library ref to my Android Project. No direct ref of EF to my Android Project - Pritish
this doesn't matter, you still have a reference to EF6 which can't be resolved. rewrite the DAL with EF Core or host Webservice (WCF, SignalR) with old EF6 and consume the service in the app. - magicandre1981

2 Answers

1
votes

Just like @magicandre1981 said. Entity Framework doesn't fit in Xamarin.Android project. You need to use EntityFramework Core.

For a simple jump in and brief introduction, you can refer to Building Android Apps with Entity Framework.

1
votes

For a windows application with this error:

If your copying the exe to a different folder from /bin/ You also need to include a copy of the application .config file along with the EntityFramework.xml and EntityFramework.SqlServer.xml files.