.putty P1DocsProgramming
Related
AMD GAIA 0.17.6: Open-Source Local AI Now Connects to Your Gmail10 Critical Truths About JavaScript's Date Handling and the Temporal RescueAI Agent Now Debugging Flaky Tests in Java — JetBrains Unveils Breakthrough ToolingFrom Reading to Mastery: 7 Essential Steps to Truly Understand Algorithms3 Lesser-Known Windows Fixes That Outperform a Factory ResetMaximizing Your Impact: Participating in the 2025 Go Developer SurveySwift Web Apps Hit Production Milestone: Studioworks Processes Millions in Invoices with Near-Zero CrashesHow to Govern AI Agent Sprawl in Your Enterprise: A Step-by-Step Guide

Microsoft Replaces C++ Node.js Addons with C# and .NET Native AOT in C# Dev Kit

Last updated: 2026-05-04 09:34:10 · Programming

Breaking: C# Dev Kit Eliminates Python Dependency for Native Addons

Microsoft's C# Dev Kit team has overhauled their Node.js native addon build process, replacing C++ modules with C# code compiled via .NET Native AOT. The move eliminates the need for Python and node-gyp, a long-standing pain point for developers.

Microsoft Replaces C++ Node.js Addons with C# and .NET Native AOT in C# Dev Kit
Source: devblogs.microsoft.com

“We already have the .NET SDK installed, so using C# and Native AOT to streamline our engineering systems was a natural step,” said a Microsoft engineer familiar with the project. “This removes an entire class of setup friction for contributors and CI pipelines.”

Background: The old way

Historically, the C# Dev Kit extension used native Node.js addons written in C++ for platform-specific tasks like reading the Windows Registry. These addons were compiled with node-gyp, which requires an old version of Python on every developer machine.

For a team focused on .NET tooling, that Python dependency added significant overhead. New contributors had to install tools they’d never use directly, and CI pipelines spent extra cycles provisioning and maintaining Python environments.

How .NET Native AOT simplifies the process

Node.js native addons are shared libraries (.dll, .so, or .dylib) that export a specific entry point called napi_register_module_v1. The N-API (Node-API) interface is language-agnostic—it only requires the library to export the right symbols.

.NET Native AOT can produce such shared libraries from C# code. The new addon project file is minimal:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net10.0</TargetFramework>
    <PublishAot>true</PublishAot>
    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
  </PropertyGroup>
</Project>

The PublishAot flag tells the SDK to emit a shared library, while AllowUnsafeBlocks permits the function pointers and fixed buffers that N-API interop requires. The entry point is defined with [UnmanagedCallersOnly] attribute.

Microsoft Replaces C++ Node.js Addons with C# and .NET Native AOT in C# Dev Kit
Source: devblogs.microsoft.com

What This Means

Developers using the C# Dev Kit will no longer need to install Python or manage a separate C++ build chain. This reduces setup time for new contributors and simplifies CI/CD configurations.

More broadly, this demonstrates that .NET Native AOT can serve as a viable alternative to C++ for building Node.js native addons. Teams already invested in the .NET ecosystem can leverage their existing skills and tooling without sacrificing performance.

“This is a win for developer productivity,” the engineer added. “We get the same native performance with fewer dependencies and a unified build pipeline.”

Looking ahead

Microsoft plans to continue refining the approach and is evaluating whether to open-source the pattern for other teams to adopt. The move could encourage broader adoption of .NET Native AOT for cross-platform native extensions in the Node.js ecosystem.

For now, the C# Dev Kit team recommends that .NET shops explore Native AOT documentation as a starting point for similar migrations.