Unable to load DLL 'SQLite.Interop.dll' (0x8007007E) using nuget version 126.96.36.199 of System.Data.Sqlite
I just updated my project to version 188.8.131.52 of System.Data.Sqlite and I got an error when loading SQLite.Interop.dll. I was able to minimize to a simple example, available here https://github.com/andrewhickman/sqlite-repro
To reproduce, run this docker command (using windows containers) on the latest commit in that repository
docker build . -t sqlite-repro ; docker run -it --rm sqlite-repro
I get the following exception
Unhandled exception. System.DllNotFoundException: Unable to load DLL 'SQLite.Interop.dll' or one of its dependencies: The specified module could not be found. (0x8007007E) at System.Data.SQLite.UnsafeNativeMethods.sqlite3_config_none(SQLiteConfigOpsEnum op) at System.Data.SQLite.SQLite3.StaticIsInitialized() at System.Data.SQLite.SQLiteLog.PrivateInitialize(String className) at System.Data.SQLite.SQLiteLog.Initialize(String className) at System.Data.SQLite.SQLiteConnection..ctor(String connectionString, Boolean parseViaFramework) at System.Data.SQLite.SQLiteConnection..ctor(String connectionString) at SqliteRepro.Program.Main(String args) in C:\source\Program.cs:line 10
Running the same command on the previous commit (37ec7a771d30ba1b6a0d506efc7d8ab858852e31), it runs successfully. The only difference is going from version 184.108.40.206 to 220.127.116.11 of System.Data.Sqlite
dotnet run in the repository works fine on both versions on my machine (again using Windows)
This recent post describes a problem created by an MSBuild change which I suspect has led to your issue. Either getting an MSBuild update or manually specifying another target to get SQLite.Interop.dll copied should function as a work-around. Or you could just copy the DLL yourself until that update is generally available.
This actually seems to be caused by some extra dependencies in the latest version of SQLite.Interop.dll.
Using dumpbin I compared the dependencies between version 18.104.22.168 and 22.214.171.124 and these new dependencies were added:
mscoree.dll 1801473F0 Import Address Table 180186090 Import Name Table 0 time date stamp 0 Index of first forwarder reference 6F StrongNameSignatureVerificationEx 71 StrongNameTokenFromAssembly 62 StrongNameFreeBuffer F CorBindToRuntimeEx 61 StrongNameErrorInfo WINTRUST.dll 1801473E0 Import Address Table 180186080 Import Name Table 0 time date stamp 0 Index of first forwarder reference 82 WinVerifyTrust
mscoree.dll is not available in in the mcr.microsoft.com/dotnet/core/runtime image I was using. If I copy it in from a different image, SQLite.Interop.dll is loaded successfully