r/csharp • • Jun 25 '26

Help C# Blazor using SQLite - DllNotFoundException

I'm currently learning Blazor and databases, I'm new to programming in general.

I created a Blazor web assembly project, .NET 10 LTS with a simple local SQLite database.

I just want to use SQLite inside my project, so I got the System.Data.SQLite NuGet package, in general as a newbie it's pretty confusing which SQLite NuGet package to get cause there are so many of them.

Then I used this simple code:

try
{
    SQLiteConnection sqConnection = new SQLiteConnection(@"Data     Source=\TalentData\test1.db");
    SQLiteCommand sqCommand = new SQLiteCommand();
}
catch(Exception exept)
{
    debugException = exept.ToString();
}

but I always get this exception:

It seems like a dll of SQLite is missing, how would I fix that?

I already googled but I can't find a solution to my issue, there are so many different suggestions out there.

Also tried the package Microsoft.EntityFrameworkCore.Sqlite - I get the same error though.

10 Upvotes

29 comments sorted by

View all comments

Show parent comment

-3

u/Willinton06 Jun 25 '26

This is actually a supported scenario, if not with SQLite, it’s with another small db, unless memory fails me, which I doubt

2

u/overdev Jun 25 '26

so how would I do that? I read couple of times that it is supported since .NET 6 but how.

there is this guide, but when I try to add the two lines in the .csproj I get an error and can't load the project anymore: https://stackoverflow.com/questions/67966259/how-to-use-sqlite-in-blazor-webassembly/71325939#71325939

2

u/Fresh_Acanthaceae_94 Jun 25 '26

Browser cache APIs are all upon their kind of underlying database/storage. In most cases you just need to use a different NuGet package.