Unable to load DLL sqlite3 in Universal Windows App running on Mobile

Stam picture Stam · Aug 6, 2015 · Viewed 11.5k times · Source

I am developing a UWP. I am using the sqlite-net-pcl library. After upgrading my Application from RC to RTM , I got a runtime error - sqlite3.dll could not be found - if it runs on a Mobile emulator or a device. It worked prefectly after I added a reference to C++ 2013 Runtime Package and I ran it in Local Machine.

Exception Message:

Message "The type initializer for 'SQLitePCL.raw' threw an exception." string

The innerexception message:

{"Unable to load DLL 'sqlite3': The specified module could not be found. (Exception from HRESULT: 0x8007007E)"} System.Exception {System.DllNotFoundException}

Of course I could not add a referece to 'Sqlite for Universal App Platform' because I am geting the following error

Severity Code Description Project File Line Error Payload contains two or more files with the same destination path 'sqlite3.dll'. Source files: C:\Program Files (x86)\Microsoft SDKs\UAP\v0.8.0.0\ExtensionSDKs\SQLite.UAP.2015\3.8.11.1\Redist\Debug\ARM\sqlite3.dll C:\Users\sMavrikis.nuget\packages\SQLitePCL.raw_basic\0.7.1\build\native\sqlite3_dynamic\winrt81\arm\sqlite3.dll TestApp1

Answer

iftitaj picture iftitaj · Aug 8, 2015

Add a reference to 'SQLite for Universal App Platform' This will trigger the error:

Payload contains two or more files with the same destination path 'sqlite3.dll'.

This error occurs because of different version of sqlite3.dll in both the locations marked by the error. Resolve this error by simply copying

C:\Program Files (x86)\Microsoft SDKs\UAP\v0.8.0.0\ExtensionSDKs\SQLite.UAP.2015\3.8.11.1\Redist\Debug\ARM\sqlite3.dll

to

C:\Users\%USERNAME%\.nuget\packages\SQLitePCL.raw_basic\0.7.1\build\native\sqlite3_dynamic\winrt81\arm\sqlite3.dll

overwriting existing file.

Rebuild your project. It should compile now.