How do I call SQLitePCL.Batteries.Init().?

I had this very exact error. It turned out that I had package Microsoft.Data.Sqlite.Core (2.2.4) installed, but not SQLitePCLRaw.bundle_winsqlite3.

Installing package SQLitePCLRaw.bundle_winsqlite3 (1.1.13) solved the issue.


Switching from Microsoft.Data.Sqlite.Core to Microsoft.Data.Sqlite as Patrick said here did the trick for me


This happened to me when I tried to avoid any additional dependencies and went for the Microsoft.EntityFrameworkCore.Sqlite.Core package.

You should install and use the Microsoft.EntityFrameworkCore.Sqlite package instead, which has a dependency upon the SQLitePCLRaw package.


Install Nuget Package Microsoft.Data.Sqlite (not Microsoft.Data.Sqlite.Core). (my version is 2.2.2)

and use SQLitePCL.raw.SetProvider(new SQLitePCL.SQLite3Provider_e_sqlite3());

 connection = new SqliteConnection("Data Source = Sample.db");

 SQLitePCL.raw.SetProvider(new SQLitePCL.SQLite3Provider_e_sqlite3());

 connection.Open();

but I advise use nuget package System.Data.SQLite instead Microsoft.Data.Sqlite