WinFsp.Native 0.1.1

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package WinFsp.Native --version 0.1.1
                    
NuGet\Install-Package WinFsp.Native -Version 0.1.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="WinFsp.Native" Version="0.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="WinFsp.Native" Version="0.1.1" />
                    
Directory.Packages.props
<PackageReference Include="WinFsp.Native" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add WinFsp.Native --version 0.1.1
                    
#r "nuget: WinFsp.Native, 0.1.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package WinFsp.Native@0.1.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=WinFsp.Native&version=0.1.1
                    
Install as a Cake Addin
#tool nuget:?package=WinFsp.Native&version=0.1.1
                    
Install as a Cake Tool

WinFsp.Native

NuGet CI License: MIT

Zero-alloc, AOT-ready WinFsp binding for modern .NET — build user-mode file systems on Windows with native performance.

Why WinFsp.Native?

WinFsp.Native Official WinFsp.Net
Native AOT Full support (IsAotCompatible) Not compatible (reflection-based)
Target .NET 8+ .NET Standard 2.0 / .NET Framework 3.5
Hot-path alloc Zero managed heap allocation Allocates per callback
P/Invoke [LibraryImport] source generator [DllImport] with marshaling
Async I/O ValueTask<T> + STATUS_PENDING Synchronous only
API style IFileSystem interface + FileSystemHost Inheritance-based FileSystemBase
Dependencies Zero NuGet dependencies Microsoft.Win32.Registry + System.IO.FileSystem.AccessControl

Quick Start

dotnet add package WinFsp.Native
using WinFsp.Native;

class MyFs : IFileSystem
{
    public bool SynchronousIo => true;

    public int GetVolumeInfo(out ulong totalSize, out ulong freeSize, out string volumeLabel)
    {
        totalSize = 1024 * 1024;
        freeSize = 512 * 1024;
        volumeLabel = "MyDrive";
        return NtStatus.Success;
    }

    // Implement other IFileSystem methods...
}

// Mount
var host = new FileSystemHost(new MyFs());
host.Mount("Z:");

Two API Levels

High-Level: IFileSystem + FileSystemHost

Implement the IFileSystem interface with familiar .NET types (string, Memory<byte>, ValueTask<T>). The FileSystemHost handles all WinFsp plumbing — mounting, callback dispatch, async STATUS_PENDING, buffer management, and cancellation.

using WinFsp.Native;

// One using gets you everything: IFileSystem, FileSystemHost, NtStatus,
// FspFileInfo, CleanupFlags, CreateOptions, result types, etc.

Low-Level: WinFspFileSystem

Direct function pointer access to all 64 WinFsp callback slots. Full control, zero abstraction overhead.

using WinFsp.Native;
using WinFsp.Native.Interop; // FspVolumeParams, FspFileSystemInterface, etc.

var fs = new WinFspFileSystem();
fs.VolumeParams.SectorSize = 4096;
fs.Interface.Read = &OnRead;
fs.Mount("Z:");

Prerequisites

  • Windows 10/11
  • WinFsp 2.x installed (with Developer files for building)
  • .NET 8.0+ SDK

Project Structure

src/WinFsp.Native/           # The binding library
tests/WinFsp.Native.Tests/   # Integration tests (mounts real WinFsp FS)
examples/HelloFs/             # Minimal read-only file system example

Building

dotnet build
dotnet test
dotnet pack

License

MIT — see LICENSE.

Runtime dependency: WinFsp (GPLv3 with FLOSS exception). WinFsp must be installed on the target machine. This binding library does not redistribute WinFsp binaries.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.2-pre.3 63 5/3/2026
0.1.1 140 4/6/2026
0.1.0 98 4/6/2026