Unable to load DLL 'sqlite3': The specifie

2019-01-18 08:30发布

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

标签: sqlite3
13条回答
一纸荒年 Trace。
2楼-- · 2019-01-18 09:08

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)

查看更多
神经病院院长
3楼-- · 2019-01-18 09:08

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.

查看更多
放荡不羁爱自由
4楼-- · 2019-01-18 09:08

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.

查看更多
成全新的幸福
5楼-- · 2019-01-18 09:10

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.

enter image description here

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. enter image description here

查看更多
Emotional °昔
6楼-- · 2019-01-18 09:11

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.

查看更多
祖国的老花朵
7楼-- · 2019-01-18 09:12

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

查看更多
登录 后发表回答