Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to load DLL 'sqlite3' in SQLite Net Platform WinRT

I am in process of developing native app using Xamarin.Forms. But the problem I am facing now is not related with Xamarin. I added new Windows Phone project by

right-click > Add > New Project -> Windows Phone Apps -> Blank App(Windows Phone).

in my existing Xamarin project in Visual Studio premium 2013. I am using sqlitenet pcl for database connection. I have below code in my project.

public ISQLitePlatform CreateSqlitePlatformInterface()
        {
            return new SQLitePlatformWinRT();
        }

When it executes above line, it throws exception as

An exception of type 'System.DllNotFoundException' occurred in SQLite.Net.Platform.WinRT.DLL but was not handled in user code

Additional information: Unable to load DLL 'sqlite3': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

This has been asked many many times and I tried all suggested solution, still I am not able to fix it.

My Packages.config

 <package id="SQLite.Net-PCL" version="3.0.5" targetFramework="wpa81" />
  <package id="Sqlite-Winrt" version="3.8.7.1" targetFramework="wpa81" />
  <package id="Xamarin.Forms" version="1.4.2.6359" targetFramework="wpa81" />

Above are the packages I downloaded from Nuget. Am I missing anything? What else I need to add?

Also I tried:

  1. Downloaded sqlite-winrt81-3081002.vsix from Sqlite download page.
  2. Copied sqlite3.dll from x86.
  3. Tried pasting it in my bin folder as well as in my project root and changed it content to copy always. (ref: https://stackoverflow.com/questions/4744293/unable-to-load-dll-sqlite3-the-specified-module-could-not-be-found-exceptio)
  4. My project is targeting x86 not Any CPU.

Tried suggested solution from: Sol1, Sol2

My Project References:

enter image description here

like image 894
subha Avatar asked Jun 25 '15 06:06

subha


1 Answers

After installing the SQLite Visual Studio Extension, you need to add a reference To the SQLite for Windows Runtime In Reference Manager under Windows / Extensions.

Like this.

like image 89
Derek Beattie Avatar answered Sep 17 '22 18:09

Derek Beattie