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

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

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.

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.

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.

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.

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

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).

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..."

Related

Error Running UWP Project (UniversalWindows)

I am making a crossplatform xamirin forms application that should run on android and pc windows.
During compiling the UWP version I get the exceptions:
Can not resolve Assembly or Windows Metadata file
'Xamarin.Forms.Platform.WP8.dll
and
Type universe can not resolve assembly: Xamarin.Forms.Platform.WP8,
Version = 1.5.0.0, Culture = neutral, PublicKeyToken = null
I read about these exceptions on the internet and from what I could see, it is related to the Xlabs plugin being used in the application. Is this information correct?
If yes, would I have some way to fix it without removing the Xlabs plugin, why am I using it on multiple forms to be able to checkboxes.
I faced this issues because of Nuget package was not up to date in my every project. I tried to fix this issues using below step.
Close the Visual Studio/Xamarin Studio.
Delete the Nuget package folder from root directory.
Delete the all bin, obj and debug folder from every project folder.
Right click on every project of Package folder and try to update.
Clean the all solution and Rebuild all.

System.Data.SQLite 1.0.101 unable to load dll since last update

I have a Xamarin Forms project, in which I use the nuget package System.Data.SQLite (v1.0.101 last updated in 04/19/2016) and it was working well until some days ago.
Now I don't know if I have changed something that caused my app to crash, or if the last update of the package is the reason I cannot run it anymore.
I am trying to run a Windows Phone 8.1 (not Silverlight) app in debug mode and x86 target on my local emulator.
The error I get is:
Unable to load DLL 'sqlite3': The specified module could not be found.
(Exception from HRESULT: 0x8007007E)
Any help?
It seems to be missing the native sqlite3 library. If you have, or can restore, the previous Nuget package, can you compare them to see if library has been moved or accidentally left out?

Getting Started with SQLite PCL

All,
I am struggling to get off the ground with SQLite. I cannot seem to find the right search terms to get the answer I need, so have come here.
I simply want to do this: have a single dll (PCL) that contains all my SQLite logic. I have installed the NuGet package SQLitePCL from Microsoft Open Technologies into this PCL project. I have written a single method that opens a connection.
I then have a test harness console application that references my PCL DLL project. That, in its root, has the file SQLite3.dll, that I downloaded from the SQLite site. Obviously, this console application calls my OpenConnection method in the library dll.
I am getting the error:
Additional information: A SQLite Wrapper assembly for the current platform was not found. Ensure that the current project references both SQLitePCL and the following platform-specific assembly: SQLitePCL.Ext
So my questions are:
where do I get that platform specific assembly from?
Is there an article on the web that specifically demonstrates how to do this?
Help gratefully appreciated,
Gray
Ok ... the answer to this was painfully simple. The platform specific assemblies are in the "packages\SQLitePCL.3.8.5.1\build" folder (put there by NuGet, of course). I just copied the dll from the sub folder Netcore451 into the root of my console app.

Type or namespace 'Sqlite' could not be found in SQLite.cs

I have a Windows Phone 8 app that utilizes SQLite. The app has many database functions, and includes a sqlite database file which, upon running the app, is copied to the local folder and accessed. All of this worked with no problem until I first switched to release build, upon which it did not work.
I "fixed" this by deleting all NuGet references and .dll references and started over following the steps here:A Workaround to Use SQLite in a Windows Phone 8 Application
I am having a frustrating problem where, after switching from debug to release build, or vice versa, 'Sqlite' is once again no longer recognized.
I get the following errors:
The type or namespace name 'Sqlite' could not be found (are you missing a using directive or an assembly reference?)
These errors are coming from SQLite.cs, specifically these lines:
using Sqlite3 = Sqlite.Sqlite3;
using Sqlite3DatabaseHandle = Sqlite.Database;
using Sqlite3Statement = Sqlite.Statement;
How is this possible? I saw some similar questions on here, but all of them simply said to delete and re-add the references and the problem inexplicably goes away. This is not working for me.
Follow this article to configure your project. Also explained here
Second you will need to go to the GITHUB website and download the
code for SQLite-net-wp8. This is a c++ project you will need to
access a sqlite database.
Make you sure you set Conditional compilation symbols: USE_WP8_NATIVE_SQLITE and release is x86 or ARM.
Tested on VS Profesional 2013, Release build (x86, ARM)
Go thorough bellow link
Windows Phone 7 Native Database Programming via Sqlite Client for Windows Phone
Hope it will help you

Use Manifest Tool (mt.exe) to Change "Version" of "Unmanaged Assembly"

Now that native code can have assemblies (e.g. "unmanaged assembly") for side-by-side cache usage, I'm interested in changing the version of a DLL after it is built (as part of an incremental build auto-versioning scheme). I think I'm close using this commmand:
mt -updateresource:MyNewlyBuiltThing.dll;#2 -identity:"MyNewlyBuiltThing, version=5.5.0.1"
That command gives me the following error:
mt.exe : general error c101008d: Failed to write the updated manifest to the resource of file "MyNewlyBuiltThing.dll". Access is denied.
That command is executed from a command prompt with administrator privileges, and I have no anti-virus software on my development box (and the file does not have a read-only flag set).
Perhaps the problem is that I'm using the wrong name in the identity string. After all, when I load the embedded resource of the binary into Visual Studio, it shows a manifest that doesn't bother to mention its name - it only mentions the names of dependencies.
Anyway, I was just wondering if the mt.exe could be coaxed into giving me the post-build version-bumping of a non-managed assembly. Any insight of what I'm doing wrong? And if this is not possible, why?
If permissions issues have been ruled out:
Are you running on a FAT filesystem? There may be issues if not on NTFS. Also, several issues of this type are gone with the latest mt.exe, part of the "Microsoft Windows SDK for Windows 7 and .NET Framework 4", version 7.1 so you could try that.

Resources