NetNsCore 0.2.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package NetNsCore --version 0.2.0
                    
NuGet\Install-Package NetNsCore -Version 0.2.0
                    
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="NetNsCore" Version="0.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NetNsCore" Version="0.2.0" />
                    
Directory.Packages.props
<PackageReference Include="NetNsCore" />
                    
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 NetNsCore --version 0.2.0
                    
#r "nuget: NetNsCore, 0.2.0"
                    
#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 NetNsCore@0.2.0
                    
#: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=NetNsCore&version=0.2.0
                    
Install as a Cake Addin
#tool nuget:?package=NetNsCore&version=0.2.0
                    
Install as a Cake Tool

NetNsCore

A lightweight C# library for managing Linux network namespaces. Wraps unshare, setns, mount, and umount2 syscalls with a clean, disposable API. AOT-compatible, Linux-only, .NET 10+.

License: MIT NetNsCore release NetNsCore download count

Usage

using NetNsCore;

// Create and enter a namespace — automatically restored on dispose
NetNs.Create("my_ns");
using (NetNs.Enter("my_ns"))
{
    // code runs inside "my_ns"
}
NetNs.Delete("my_ns");

API

Member Description
Create(name) Create a named network namespace
Delete(name) Delete a named network namespace
Exists(name) Check whether a named namespace exists
List() List all namespace paths under /run/netns/
Open(name) Open a handle to a named namespace
OpenCurrent() Open a handle to the current thread's namespace
OpenRoot() Open a handle to the root (PID 1) namespace
Enter(name) Enter a namespace; returns a Scope that restores the original on dispose
EnterRoot() Enter the root namespace
ns.Enter() Enter via handle
ns.Clone() Clone handle (duplicates the file descriptor)
ns.Id Unique UInt128 identifier
ns.Descriptor Underlying FileDescriptor
Product Compatible and additional computed target framework versions.
.NET 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.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on NetNsCore:

Package Downloads
LibNlCore

NETLINK .NET wrappers

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.2.1 105 2/25/2026
0.2.0 89 2/25/2026
0.1.3 178 2/4/2026
0.1.2 102 1/6/2026
0.1.1 103 1/5/2026
0.1.0 108 1/4/2026