2

I get the following problem every time I try to run my mobile application:

System.DllNotFoundException: 
'SQLite.Interop.dll assembly:<unknown assembly> type:<unknown type> member:(null)'

To put this in some context:
I am developing on Xamarin.Forms [4.3.0] (in this case running the build on Android 9.0 x86). The client-side library runs on .NET Standard 2.0 and I have installed System.Data.SQLite.Core (1.0.112) from NuGet.

When you look up my problem, you will find people saying to put the SQLite.Interop.dll's into the x86/x64 folders.
But when looking for these files there are none for .NET Standard at all, only for .NET Framework. I tried using the SQLite.Interop.dll's from the precompiled statically-linked binaries from the .NET Framework 4.6 version.

Screenshot of the project structure

Same error though.

Unfortunately, it is not possible for me to switch the SQLite library as I am porting a desktop version to mobile which uses this lib.

theannomc1
  • 23
  • 6
  • You are running `Xamarin Forms` 1.3? On an `Android` 9 device? I don't think that's even possible! And that too with .Net Standards! In any case Which SQLite NuGet package are you using? – FreakyAli Mar 06 '20 at 10:05
  • Sorry, 1.3.0 refers to Xamarin.Essentials not Forms, which is 4.3.0.908675. Version of SQLite is linked in the question. – theannomc1 Mar 06 '20 at 10:14
  • Are you using the correct nuget package for SQLite? i.e. https://www.nuget.org/packages/sqlite-net-pcl/1.7.302-beta – FreakyAli Mar 06 '20 at 11:22

2 Answers2

2

if they have not made a mess in the classes and functions you need to port you can use "Microsoft.Data.SQLite", there is a difference but is not as far away from usable as the crazy nonsense you need to do with "SQLite-Net-Pcl"

Petrov
  • 66
  • 2
0

Many thanks for the excellent answer. I was using sqlite.net-pcl package and getting strange errors and searching web for anwers and not finding any that works. I added the Microsft.Data.Sqlite and Bingo! All my problems were solved. I just followed the syntax posted at: https://github.com/dotnet/docs/blob/main/samples/snippets/standard/data/sqlite/HelloWorldSample/Program.cs

A Meyer
  • 1
  • 1