RocksDB-Sharp

Installation

RocksDB-Sharp is distributed as a single NuGet package that contains the managed C# binding and the precompiled native RocksDB binaries for Windows, Linux, and macOS (x64 / arm64 where available). There is no separate native install step — the right runtime is loaded automatically the first time you call into the library.

View on NuGet View on GitHub


Install the package

dotnet add package RocksDb
Package name

The NuGet package is published as RocksDb (the assembly and namespace are both RocksDbSharp). See nuget.org/packages/rocksdb for the latest version.


Versioning

The package version mirrors the upstream RocksDB release plus a build suffix.

NuGet Version RocksDB Release
X.Y.Z.<build> vX.Y.Z
e.g. 6.7.3.6120 v6.7.3

A new package is published automatically (via Azure Pipelines) on every official RocksDB release, so upgrading is just a matter of bumping the NuGet version.


Supported platforms

OS Architecture Native binary
Windows x64 rocksdb.dll
Linux x64 librocksdb.so
Linux arm64 librocksdb.so
macOS x64 librocksdb.dylib
macOS arm64 (Apple Silicon) librocksdb.dylib

The native loader (AutoNativeImport) picks the correct file from the runtimes/<rid>/native/ folder shipped inside the NuGet package.


.NET target frameworks

RocksDB-Sharp targets .NET Standard 2.0 plus modern .NET. On modern runtimes (net6.0+) you also get the Span<byte> / ReadOnlySpan<byte> overloads on Put, Get, Merge, Remove, and the iterators.

Target Available APIs
netstandard2.0 string / byte[] overloads
net6.0+ All overloads, including ReadOnlySpan<byte>, ISpanDeserializer<T> and unsafe fast paths

Verify the install

Create a tiny console app and run it — if it prints Hello, RocksDB, you're set.

app/Program.cs
using RocksDbSharp;

var path = Path.Combine(Path.GetTempPath(), "rocks-hello");
using var db = RocksDb.Open(new DbOptions().SetCreateIfMissing(true), path);

db.Put("greeting", "Hello, RocksDB");
Console.WriteLine(db.Get("greeting"));
dotnet add package RocksDb
dotnet run
# Hello, RocksDB
Next steps

Head over to the Quick Start for a guided tour, or jump into the Guides for end-to-end recipes.


Troubleshooting native loading

If you see DllNotFoundException for rocksdb (or librocksdb):

  • Make sure your project actually copies the runtimes/ folder. Self-contained publishes and <PublishSingleFile>true</PublishSingleFile> apps need <IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>.
  • On Linux, ensure libstdc++ and glibc are recent enough — the binaries are built against modern toolchains; very old distributions may need a newer libstdc++.
  • If you ship a single-file app, double-check that the native binary made it into the extraction folder at runtime.

For deeper details on how native loading works in this binding, see Native interop.

Referenced by

© 2026 RocksDB-Sharp. All rights reserved.