-->

Unable to load DLL 'sqlite3': The specifie

2019-01-18 08:41发布

问题:

I am currently using SQLite for Windows Forms but while running the project it is showing the error:

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

I had added the DLL of System.Data.SQLite.dll but it is showing the same error. Please can any one help me by giving the perfect answer regarding this problem? Thanks in advance

回答1:

Maybe you haven't added the version for the right platform? SQLite is distributed with one X86 (32 bit) assembly and one X64 (64 bit) assembly.

If your application is a 32 bit application you should use the System.Data.SQLite.dll located in the "bin" directory of the System.Data.SQLite distribution, if it is a 64 bit application you should use the one in "bin\x64".

However, from looking at the error message a second time I'm not sure if that's it. Are you making native calls to SQLite? In that case you may have to rename the dll to sqlite3.dll.

As you may know System.Data.SQLite is a bundling of the original native sqlite3.dll and a managed ADO.NET provider (unless you are using some old version in which case I'm not sure - you might need the native sqlite3.dll separately)



回答2:

This should fixed my issue. Add the following dll's.



回答3:

Use Project "Add Existing Item" and select the sqlite3.dll "As link". Click OK. Choose DLL in project and set "Copy Local" value to True.



回答4:

In my case I'm working on a UWP project. I had to add a reference to Visual C++ 2015 Runtime for Universal Windows Platform Apps and the error was gone. It can be added in the Reference Manager under Universal Windows > Extensions. Detailed solution can be found here.



回答5:

I had the same issue when I downloaded the latest sqlite provider and I tried a solution from here but it didnt work, hence I downloaded the earlier version and its works fine.



回答6:

Had this problem recently - after attaching procmon to my process, I found that the latest System.Data.SQLite libs (the ones built for .NET4) have a dependency on the MSVC 2010 runtime, and the servers didn't have this installed. Fortuantly, this can be pulled down from the Microsoft website.



回答7:

Copy sqlite3.dll to the System32 folder. It worked for me. And thanks too!



回答8:

I'm building a native Windows Phone 8.1 app with a PCL and a Droid project. I had the same error and I put the reference to the right version of sqlite3.dll (wpa81) and all worked.



回答9:

Especially if you've updated to Visual Studio 2015 RTM and are developing Universal Windows apps, try uninstalling the SQLite for Universal App Platform extension and reinstalling (see http://sqlite.org/download.html).



回答10:

I had exactly the same problem for the UWP project in a Xamarin.Forms application. Adding reference to "SQLite for Universal Windows Platform" to the UWP project solved the problem.



回答11:

All of these seem to be solutions for certain situations. For me, and for @Marlon Ticao on this page, the application just can't find the DLL.

There are 2 solutions. Copy it to a directory that is in you path (such as System32) or you can copy it into the same directory that your executable is.



回答12:

After struggling for 3 days,finally found a way to resolve.

As of March 2018,if you try to use sqlite-net via Nuget Package Manager,it adds two files and few reference dlls to your solution independent of type of project UWP or Android etc.

And after that if you compile and run the solution will fail with an exception

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

This is because it is unable to load sqlite3.dll as it is not added to the solution via NUGET package manger.So you need to add it manually.

To add,first determine your project is 32 bit or 64 bit then download the respective Precompiled Binaries for Windows Runtime from https://www.sqlite.org/download.html and add them manually (copy and paste).

So now your solution will look like below one and it will run without issues.



回答13:

I had this exact problem using a 3rd party built sqlite3.dll -- the app would not launch. I used the dependency walker to find that this sqlite3.dll had a dependency on msvcr110.dll. Once I included this file, all was well.



标签: sqlite3