Skip to content

Project Overview

This project enables advanced interoperability between .NET and JavaScript in the same process.

  • Load .NET assemblies and call .NET APIs in-proc from a JavaScript application.
  • Load JavaScript packages and call JS APIs in-proc from a .NET application.

Interop is high-performance and supports TypeScript type-definitions generation, async (tasks/promises), streams, exception propagation, and more. It is built on Node API so it is compatible with any Node.js version (without recompiling) or other JavaScript runtime that supports Node API, such as Deno.

⚠️ Status: Public Preview - Most functionality works well, though there are some known limitations around the edges, and there may still be minor breaking API changes.

Minimal example - JS calling .NET

JavaScript
const Console = require('node-api-dotnet').System.Console;
Console.WriteLine('Hello from .NET!'); // JS writes to the .NET console API

Minimal example - .NET calling JS

C#
interface IConsole { void Log(string message); }

var nodejs = new NodejsPlatform(libnodePath).CreateEnvironment();
nodejs.Run(() =>
{
    var console = nodejs.Import<IConsole>("global", "console");
    console.Log("Hello from JS!"); // C# writes to the JS console API
});

For more complete example projects, see the examples directory in the repo. Or proceed to the next page to learn about the different supported scenarios and how to get started with your own project.

Released under the MIT license