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

7

15

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

Pinchpenny answered 6/8, 2015 at 8:49 Comment(0)
D
32

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.

Dynamoelectric answered 8/8, 2015 at 17:44 Comment(3)
Thank you. It is help for me. I have a different way. It can be seen in the error message.Runofthemill
As said above, you have to copy from and to the folders indicated in your own error (they were different for me). What made my app compile was to copy from program files to the package folder. Also note that this solution not always works (I tried it with two different apps and it only worked on one of them)Calamine
This solved it for me thanks. Won't this be a problem for other people importing the project then?Banister
A
8

If you look at the two conflicting locations, one seems to be coming from a more official Microsoft extension for UWP, while the second is coming from a nuGet package.

When I encountered this error, I needed the functionality of the nuGet package, so I decided to keep it and drop the other reference. I right clicked on the project in the solution explorer and went to Add->Reference and then unchecked the reference to SQLite. Seemed less error prone than copying the file from one location to the other to me.

enter image description here

Avilla answered 14/6, 2016 at 6:1 Comment(1)
This answer helped me notice that I was referencing the Microsoft Visual C++ 2013 Runtime Package rather than the Visual C++ 2015 Runtime for Universal Windows package. Fixing the references fixed the problem for me.Limb
T
2

I was getting the same error messages. I had started by using SQLite-PCL which also required SQLite for Universal App Platform as a reference. Later I switched to SQLite.Net-PCL. That is when I got those errors. In researching a solution I found this page. It worked for a bit. Eventually I removed the Reference to SQLite for Universal App Platform and the errors went away.

Transparent answered 29/1, 2016 at 18:51 Comment(0)
D
0

late reply, but had the issue now; What fix it for me was to do Nuget Package update on all the project in the solution as one of the packages was still using the old reference and was pulling through to the Running project referencing the other project that was out of date.

Duntson answered 26/2, 2016 at 10:32 Comment(0)
S
0

I fixed a similar issue by selecting x64 or arm in the compiler configuration.

Error Payload contains two or more files with the same destination path 'e_sqlite3.dll'. Source files: C:\Users\xleon.nuget\packages\SQLitePCLRaw.lib.e_sqlite3.v140\1.1.0\runtimes\win10-arm\native\e_sqlite3.dll C:\Users\xleon.nuget\packages\sqlitepclraw.lib.e_sqlite3.v140\1.1.0\runtimes\win10-x86\native\e_sqlite3.dll

but this, of course, won´t allow you to run the emulator

Septennial answered 31/3, 2017 at 2:36 Comment(0)
K
0

Right-Click on the UWP Project and choose Properties.

And make sure the Solution Platform target matches the Project Platform target.

If they are different you will get the build error about copying files to the same destination with the same name (but different target platforms).

Ensure matching target platforms

Kamilahkamillah answered 8/10, 2017 at 14:14 Comment(0)
S
0

I managed to solve the disparity by putting a conditional in the UWP .csproj for including the SQLite dll

<SDKReference Include="SQLite.UWP.2015, Version=3.19.3" Condition="'$(Configuration)'=='Debug'">
  <Name>SQLite for Universal Windows Platform</Name>
</SDKReference>

I needed to run with the UWP version for debugging, else my XAMl designer would blow up with "Can't find SQLite.dll..."

Seraphine answered 27/10, 2017 at 9:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.