.NET: Microsoft Technologies based on the .NET software framework. Runtime: An environment required to run apps that aren't compiled to machine language.
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:
- 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.
- 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();
- 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.
- 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.