Skip to content

.NET Native AOT

This project supports loading .NET libraries into a JavaScript application process, or loading JavaScript libraries into a .NET application process. In either case the .NET code can be ahead-of-time (AOT) compiled, which makes it executable without depending on the .NET Runtime.

There are advantages and disadvantages to either approach:

.NET Runtime.NET Native AOT
API compatibilityBroad compatibility with .NET APIsLimited compatibility with APIs designed to support AOT
Ease of deploymentRequires a matching version of .NET to be installed on the target systemA .NET installation is not required (though some platform libs may be required on Linux)
Size of deploymentCompact - only IL assemblies need to be deployedLarger due to bundling necessary runtime code - minimum ~3 MB per platform
PerformanceSlightly slower startup (JIT)Slightly faster startup (no JIT)
Runtime limitationsFull .NET functionalitySome .NET features like reflection and code-generation aren't supported

To use C# to create a Node.js addon using Native AOT, see .NET Native AOT for Node.js.

There is no documentation or example code yet specific to hosting JavaScript in a .NET Native AOT application, but it is not very different from non-AOT Embedding JS in .NET.

AOT limitations

Some features in this project are not available in a Native AOT environment because they depend on runtime reflection or code-generation:

Released under the MIT license