NsdRpc 0.2.0

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

nsd-rpc

A zero-dependency C# RPC framework and library built on Needlefish (nsd). Schemas in .nsd files define the wire messages. The Needlefish.Generators source generator compiles them at build time.

build test

Install

dotnet add package NsdRpc
dotnet add package NsdRpc.Tcp

The source generator NsdRpc.Generators is referenced as an analyzer. Your own schemas compile with Needlefish.Generators. See getting started for the full project setup.

Quick start

Reference the generator as an analyzer, then declare a service. The shape of each method decides if it is a client call or a server handler.

<PackageReference Include="NsdRpc.Generators" Version="0.1.0"
                  OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
[RpcService]
public interface IGreeter
{
    [RpcMethod(1)]
    Task<RpcResult<HelloResponse>> SayHelloAsync(
        HelloRequest request, CancellationToken cancellationToken = default);

    [RpcMethod(1)]
    ValueTask<RpcResult<HelloResponse>> SayHelloAsync(
        HelloRequest request, RpcContext context, CancellationToken cancellationToken);
}

public sealed class Greeter : GreeterHandler
{
    public override ValueTask<RpcResult<HelloResponse>> SayHelloAsync(
        HelloRequest request, RpcContext context, CancellationToken cancellationToken)
    {
        var response = new HelloResponse("hello " + request.Name);
        return ValueTask.FromResult(RpcResult<HelloResponse>.Success(response));
    }
}

Start a server, then call it from a client.

var registry = new RpcRegistry();
registry.AddService(new Greeter());
registry.Freeze();

var transport = new TcpServerTransport(new RpcOptions(), new TcpOptions());
var server = new RpcServer(transport, registry);
server.Start();

var connection = new TcpClientConnection(
    new RpcOptions(), new TcpOptions { Host = "127.0.0.1", Port = transport.Port });
await connection.ConnectAsync();

var clientRegistry = new RpcRegistry();
clientRegistry.Freeze();
var client = new RpcClient(connection, clientRegistry);

var greeter = new GreeterClient(client);
RpcResult<HelloResponse> result = await greeter.SayHelloAsync(new HelloRequest("world"));

HelloRequest and HelloResponse are messages from a .nsd schema. See getting started for the schema and the bare API.

Build

Prerequisites:

  • .NET 10 SDK
dotnet build
dotnet test

The build compiles NsdRpc/Nsd/*.nsd with the Needlefish.Generators source generator. There is no separate compiler step.

Docs

Start with the subject index at docs/README.md. For consumers: getting started and the quick reference. Work is tracked in docs/issues/index.md.

License

MIT

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.1

    • No dependencies.
  • net10.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on NsdRpc:

Package Downloads
NsdRpc.Tcp

A TCP transport for the nsd-rpc framework.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.3.1 132 10/20/2026
0.3.0 131 10/19/2026
0.2.0 124 10/19/2026
0.1.0 135 10/16/2026