5
votes

I'm developing a multi-platform PCL App with Xamarin.Forms using this sqlite-pcl package, as show in this sample.

WARNING The nuget site of the PCL library contains a wrong link on the left, when you go to Project Site - it points to the SQLite-net site... So I don't even know what the correct Sqlite-PCL link would be...

It worked just fine until this morning, when I tried to install some other packages (note that I didn't touch sqlite packages at first). All of a sudden, my app crashed at first DB access saying that

System.IO.FileLoadException: 'Could not load file or assembly 'SQLite-net, Version=1.4.118.0, Culture=neutral, PublicKeyToken=null'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Well, ok, I started searching forums, trying to find which part could be the source of the issue - just nothing helped - uninstalling and re-installing the package, rebooting, manually deleting all references to that dll I found and recompiling, re-deploying... I'm actually stuck, I tried Fuslogvw without succes... I am quite desperate about this - any suggestion as to how I could find the origin of the problem?

Technical details: - VS Community 2017 - Build configuration: Debug - Any CPU - UWP on locale maching - is there any other relevant data?

OK, after hours of searaching, and thanks to @yuri-s, I re-installed the SQLite.Net.Async-PCL package. I had to update some using clauses, but eventually, I seem to get there.

However, I am stuck with one last point: I need to create the DB connection using platform-specific assembly in this specific library - but I couldn't find what the code in the approach suggested here (last post). But I couldn't figure out what code was supposed to get into the dependency interface of each OS (SQLite.Net.Platform does not seem to exist in that package).

Alltogether, the SQLite-PCL packages are quite confusing - I think that the community would benefit from a clear distinction of them...!

4
[Sorry for the poor english] Check if these other packages have some shared dependency with your version of sqlite-net. Maybe it have updated that dependence and it messed it all. - Diego Rafael Souza
Same thing happened as soon as I updated the NuGet packages today. Your answer cleared everything up - thanks. - Joe Mayo

4 Answers

4
votes

install sqlite-net-pcl version 1.3.3 (previous version not current)

current version 1.4.118.0 has this problem

2
votes

There seems to be quite a lot of confusion between the different PCL versions...

I managed to get it working following tutorial.

Key point to remember:

  1. Install SQLite.NET.Async-PCL v3.1.1 for all projects (once via Manage NuGet packages for solution),

  2. Install the SQLite.NET-PCL v3.1.1 for all projects (had to do it individually, via the NuGet Console) - NOTE: make sure it installs for the correct project (if not, it will complain that the package already exists),

  3. For UWP, one also need to add the Visual Studio extension for UWP and add references to it manually via References->Add.

So all that and it finally worked - so the mismatch was between packages of 1. and 2. (updating 1. implies one should also update individual packages in 2.)...

Hope that this will help anyone who gets confused between the SQlite packages (and, see warning in question - links to project pages on the NuGet Library pages are NOT correct!!!)

2
votes

Filed this as an issue on Github

Should be resolved in 1.5.166-beta

0
votes

Fixed when I had same issues with "sqlite-net-pcl -Version 1.4.118" couldn't downgrade due to .net v4.5

upgraded to beta version sqlite-net-pcl -Version 1.5.166-beta and it works.