Share via

Library e_sqlite3 not found

Vivek Nuna 30 Reputation points
2026-03-10T13:21:07.84+00:00

I am getting the below exception in my .net application targeting to .net 4.7.2 and platform set as Any CPU. I have tried many things but couldn't succceed. Then I tried the exact same code and configuration of the official sample app which works fine for me when I set the target framework as .net 8. But it gives the same exception when I use the same code and configuration in a sample .net application.

https://github.com/dotnet/docs/tree/main/samples/snippets/standard/data/sqlite/HelloWorldSample


Library e_sqlite3 not found

plat: win

suffix: DLL

possibilities (3):

    1) C:\work\ConsoleApp9\ConsoleApp9\bin\Debug\runtimes\win-x86\native\e_sqlite3.dll

    2) C:\work\ConsoleApp9\ConsoleApp9\bin\Debug\e_sqlite3.dll

    3) C:/work/ConsoleApp9/ConsoleApp9/bin/Debug/e_sqlite3.dll

win TryLoad: C:\work\ConsoleApp9\ConsoleApp9\bin\Debug\runtimes\win-x86\native\e_sqlite3.dll

thrown: System.ComponentModel.Win32Exception (0x80004005): The specified module could not be found

   at SQLitePCL.NativeLibrary.TryLoad(String name, Loader plat, Action`1 log, IntPtr& h)

win TryLoad: C:\work\ConsoleApp9\ConsoleApp9\bin\Debug\e_sqlite3.dll

thrown: System.ComponentModel.Win32Exception (0x80004005): The specified module could not be found

   at SQLitePCL.NativeLibrary.TryLoad(String name, Loader plat, Action`1 log, IntPtr& h)

win TryLoad: C:/work/ConsoleApp9/ConsoleApp9/bin/Debug/e_sqlite3.dll

thrown: System.ComponentModel.Win32Exception (0x80004005): The specified module could not be found

   at SQLitePCL.NativeLibrary.TryLoad(String name, Loader plat, Action`1 log, IntPtr& h)

NOT FOUND

Developer technologies | .NET | .NET Runtime
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Jack Dang (WICLOUD CORPORATION) 14,955 Reputation points Microsoft External Staff Moderator
    2026-03-11T04:00:08.34+00:00

    Hi @Vivek Nuna ,

    Thanks for reaching out.

    The managed library used by Microsoft.Data.Sqlite relies on the native SQLite engine that is loaded through SQLitePCLRaw. If that native DLL isn’t present in the build output, the runtime throws the “Library e_sqlite3 not found” exception.

    The reason your sample works when targeting .NET 8 but fails with .NET Framework 4.7.2 is that modern .NET handles native runtime assets automatically.

    A couple of things you can check:

    1. Ensure the SQLite native bundle package is installed

    Add the following NuGet package if it isn’t already referenced:

    • SQLitePCLRaw.bundle_e_sqlite3

    This package includes the e_sqlite3.dll binaries and ensures they are copied to your output directory.

    1. Initialize the SQLite bundle (sometimes required in .NET Framework apps)

    Add the initialization call early in your program (for example in Main):

    SQLitePCL.Batteries.Init();
    
    1. Verify the native library exists in the output folder

    After building, check your bin\Debug (or bin\Release) directory and confirm that e_sqlite3.dll or the runtimes\win-x86/native or runtimes\win-x64/native folders are present. If the DLL is missing, the runtime will fail to load SQLite.

    1. Check platform architecture if needed

    If your project is set to Any CPU, you may also try explicitly setting the platform target to x64 or x86 to match the available native runtime.

    If you found my response helpful or informative in any way, I would greatly appreciate it if you could follow this guidance provide feedback. Thank you.

    0 comments No comments

  2. Q&A Assist
    2026-03-10T13:21:23.3066667+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    The exception indicates that the native SQLite library e_sqlite3.dll (from SQLitePCLRaw) is not being deployed for the .NET Framework 4.7.2 app, even though it works for .NET 8 with the same managed code. For .NET Framework, the correct bundle/provider packages must be referenced explicitly so that the native binaries are copied to the output folder.

    To fix this for a .NET 4.7.2 application:

    1. Remove Microsoft.Data.Sqlite if it is bringing in a bundle that is not working correctly for the .NET Framework project.
    2. Add Microsoft.Data.Sqlite.Core and an appropriate SQLitePCLRaw bundle (or provider) that includes the native e_sqlite3 library. For example, to use the default e_sqlite3 bundle (recommended):
         dotnet add package Microsoft.Data.Sqlite.Core
         dotnet add package SQLitePCLRaw.bundle_e_sqlite3
      
      or via Package Manager Console:
         Install-Package Microsoft.Data.Sqlite.Core
         Install-Package SQLitePCLRaw.bundle_e_sqlite3
      
      Bundles like SQLitePCLRaw.bundle_e_sqlite3 are automatically initialized by Microsoft.Data.Sqlite and ensure the correct native binaries are present for each platform.
    3. Clean and rebuild the project, then confirm that under bin\Debug (or bin\Debug\<target>), a runtimes\win-x86\native\e_sqlite3.dll or equivalent path exists.

    If instead of a bundle a specific provider is desired, install SQLitePCLRaw.core plus a provider package and configure it before using Microsoft.Data.Sqlite. For example, to use the system SQLite provider:

    dotnet add package Microsoft.Data.Sqlite.Core
    dotnet add package SQLitePCLRaw.core
    dotnet add package SQLitePCLRaw.provider.sqlite3
    

    Then set the provider at startup:

    using Microsoft.Data.Sqlite;
    
    class Program
    {
        static void Main()
        {
            SQLitePCL.raw.SetProvider(new SQLitePCL.SQLite3Provider_sqlite3());
    
            using var connection = new SqliteConnection("Data Source=hello.db");
            connection.Open();
        }
    }
    

    This ensures that the correct native SQLite implementation is loaded instead of the missing e_sqlite3.dll.


    References:


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.