Powershell and SQLite on Linux

I’m trying to use SQLite via Powershell on Linux, but am not able to find a way to get the dotnet library DLL to use in the script.

I have installed these RPMs on my Fedora node:

dotnet-host-7.0.13-1.fc37.x86_64
dotnet-apphost-pack-7.0-7.0.13-1.fc37.x86_64
dotnet-hostfxr-7.0-7.0.13-1.fc37.x86_64
dotnet-targeting-pack-7.0-7.0.13-1.fc37.x86_64
dotnet-templates-7.0-7.0.113-1.fc37.x86_64
dotnet-runtime-7.0-7.0.13-1.fc37.x86_64
dotnet-sdk-7.0-7.0.113-1.fc37.x86_64

So far I have run:

  • dotnet new console
  • dotnet add pacakge Microsoft.Data.Sqlite

The instructions at SQLite with PowerShell: A Step-by-Step Guide to Database Management - SQL Docs say to download the SQLite .NET assembly for my .NET version, and add the file location to the script:

[Reflection.Assembly]::LoadFile("C:\path\to\sqlite.net\System.Data.SQLite.dll")

Downloaded the NuGet package, but I’m not sure how it relates to the DLL. Unzipping it gives:

├── [Content_Types].xml
├── package
│   └── services
│       └── metadata
│           └── core-properties
│               └── 200077654c874de7af0cb7c32d1a62bd.psmdcp
├── _rels
├── System.Data.SQLite.1.0.119.0.nupkg
└── System.Data.SQLite.nuspec

A .nuget directory tree was installed in my home dir, with several DLLs.

/home/leam/.nuget/packages/microsoft.data.sqlite.core/9.0.2/lib/net6.0/Microsoft.Data.Sqlite.dll
/home/leam/.nuget/packages/microsoft.data.sqlite.core/9.0.2/lib/net8.0/Microsoft.Data.Sqlite.dll
/home/leam/.nuget/packages/microsoft.data.sqlite.core/9.0.2/lib/netstandard2.0/Microsoft.Data.Sqlite.dll
/home/leam/.nuget/packages/sqlitepclraw.bundle_e_sqlite3/2.1.10/lib/monoandroid90/SQLitePCLRaw.batteries_v2.dll
/home/leam/.nuget/packages/sqlitepclraw.bundle_e_sqlite3/2.1.10/lib/net461/SQLitePCLRaw.batteries_v2.dll
/home/leam/.nuget/packages/sqlitepclraw.bundle_e_sqlite3/2.1.10/lib/net6.0-android31.0/SQLitePCLRaw.batteries_v2.dll
/home/leam/.nuget/packages/sqlitepclraw.bundle_e_sqlite3/2.1.10/lib/net6.0-ios14.0/SQLitePCLRaw.batteries_v2.dll
/home/leam/.nuget/packages/sqlitepclraw.bundle_e_sqlite3/2.1.10/lib/net6.0-ios14.2/SQLitePCLRaw.batteries_v2.dll
/home/leam/.nuget/packages/sqlitepclraw.bundle_e_sqlite3/2.1.10/lib/net6.0-tvos10.0/SQLitePCLRaw.batteries_v2.dll
/home/leam/.nuget/packages/sqlitepclraw.bundle_e_sqlite3/2.1.10/lib/netstandard2.0/SQLitePCLRaw.batteries_v2.dll
/home/leam/.nuget/packages/sqlitepclraw.bundle_e_sqlite3/2.1.10/lib/xamarinios10/SQLitePCLRaw.batteries_v2.dll
/home/leam/.nuget/packages/sqlitepclraw.core/2.1.10/lib/netstandard2.0/SQLitePCLRaw.core.dll
/home/leam/.nuget/packages/sqlitepclraw.lib.e_sqlite3/2.1.10/runtimes/win-arm/native/e_sqlite3.dll
/home/leam/.nuget/packages/sqlitepclraw.lib.e_sqlite3/2.1.10/runtimes/win-arm64/native/e_sqlite3.dll
/home/leam/.nuget/packages/sqlitepclraw.lib.e_sqlite3/2.1.10/runtimes/win-x64/native/e_sqlite3.dll
/home/leam/.nuget/packages/sqlitepclraw.lib.e_sqlite3/2.1.10/runtimes/win-x86/native/e_sqlite3.dll
/home/leam/.nuget/packages/sqlitepclraw.lib.e_sqlite3/2.1.10/runtimes/win10-arm/nativeassets/uap10.0/e_sqlite3.dll
/home/leam/.nuget/packages/sqlitepclraw.lib.e_sqlite3/2.1.10/runtimes/win10-arm64/nativeassets/uap10.0/e_sqlite3.dll
/home/leam/.nuget/packages/sqlitepclraw.lib.e_sqlite3/2.1.10/runtimes/win10-x64/nativeassets/uap10.0/e_sqlite3.dll
/home/leam/.nuget/packages/sqlitepclraw.lib.e_sqlite3/2.1.10/runtimes/win10-x86/nativeassets/uap10.0/e_sqlite3.dll
/home/leam/.nuget/packages/sqlitepclraw.provider.e_sqlite3/2.1.10/lib/net6.0/SQLitePCLRaw.provider.e_sqlite3.dll
/home/leam/.nuget/packages/sqlitepclraw.provider.e_sqlite3/2.1.10/lib/net6.0-windows7.0/SQLitePCLRaw.provider.e_sqlite3.dll
/home/leam/.nuget/packages/sqlitepclraw.provider.e_sqlite3/2.1.10/lib/netstandard2.0/SQLitePCLRaw.provider.e_sqlite3.dll

Suggestions?

Leam,
Welcome to the forum. :wave:t3:

IMHO that’s more a Linux systems management question than a PowerShell question. This forum is more about PowerShell code.

I’d ask this question in a Linux related forum. :wink:

Good luck!

Olaf, thanks for the welcome! I’m learning Powershell, and will probably have a lot more questions. :slight_smile:

For the most part, Linux systems management hasn’t cared about Powershell or .NET. Even the SQlite folks haven’t responded to the question, and usually they are so on top of things the keyboard has barely quit clacking before they have an answer. That’s why I’m here.

I did find GitHub - jdhitsolutions/MySQLite: A small set of PowerShell commands for working with SQLite database files., which got me a little farther along.

[Reflection.Assembly]::LoadFile("/home/leam/.local/share/powershell/Modules/mySQLite/0.14.0/assembly/linux-x64/System.Data.SQLite.dll")

Not sure of the output, though:

GAC    Version        Location
---    -------        --------
False  v4.0.30319     /home/leam/.local/share/powershell/Modules/mySQLite/0.14.0/assembly/linux-x64/System.Data.SQLite.dll

That’s great.

You’re always welcome.

That’s my impression as well so far. But I hadn’t have the need to use PowerShell on Linux so far.

Cool. So let’s wait a little longer if someone has more experience with this particular topic and is able to help.