DirectNAot 1.7.1
dotnet add package DirectNAot --version 1.7.1
NuGet\Install-Package DirectNAot -Version 1.7.1
<PackageReference Include="DirectNAot" Version="1.7.1" />
<PackageVersion Include="DirectNAot" Version="1.7.1" />
<PackageReference Include="DirectNAot" />
paket add DirectNAot --version 1.7.1
#r "nuget: DirectNAot, 1.7.1"
#:package DirectNAot@1.7.1
#addin nuget:?package=DirectNAot&version=1.7.1
#tool nuget:?package=DirectNAot&version=1.7.1
DirectN AOT
This is an AOT-friendly version of DirectN, with no reference to it. It's only for .NET 10 and beyond, it won't work with older versions nor with .NET Framework. It's aimed at 64-bit targets (x64 and ARM64). x86 works too, except for about fifty structures that the Win32 metadata lays out differently on x86, and that are generated for 64-bit only.
Don't forget to check the DirectN.Extensions nuget, a set of utilities that are not mandatory, but super useful for programming with DirectN (and COM and interop in general).
Generated, not written
Almost none of the source files here are written by hand. The interop code is generated from the official Win32 metadata, so it's a mechanical projection of the native API, not somebody's interpretation of it. That is the main reason it can be maintained for a very long time:
- over 9,000 source files are generated, against about a hundred hand-written ones. Every interface, structure, enum, constant and function is in the first group.
- by size, about 90% is generated. The rest is mostly not really code but pure definitions, constants mainly, so there is almost nothing to maintain there.
- a new Windows SDK, or a fix in the metadata, means running the generator again, not rewriting code.
What the metadata gets wrong is patched in the generator itself, in DirectN.InteropBuilder.Cli (
Patches.json, etc.), so the result stays generated. The flip side is that a change in the metadata can introduce source breaking changes for the code that uses DirectN. - the generated code has no author's coding style to keep consistent, so it doesn't drift, and nobody has to remember how it was written.
- the hand-written part is small and kept apart, it only adds what is missing from the metadata, a few types and some helper members on generated structures.
The key points that drive how code is generated and built:
- the goal for DirectN is to create built-in interop code for modern media and graphics Windows technologies only, cross-platform is not a target. That's DirectX 9 to 12, Direct2D, DXGI, Media Foundation, WIC, Direct Composition, Direct Write, WASAPI, XPS, and their dependencies.
- modern code exclusively based on source-generated
LibraryImportand source-generatedComWrappers. - how it works and how it's made is completely driven by the ComWrappers source generator and by AOT requirements, trimming and disabled runtime marshalling.
- DirectN is AOT-friendly.
unsafeusage is as limited as possible.- raw pointers (like
ISomething*) are not publicly exposed, only interface types (likeISomething), ornintdepending on the situation.objectas the out parameter type for untyped (nativevoid**) COM interfaces was considered, butnintis more universal, including for authoring scenarios (implementing COM interfaces in .NET). - all
ComObjectinstances are created using ComWrappers' "unique instance" marshalling,CreateObjectFlags.UniqueInstanceandUniqueComInterfaceMarshaller<>, as we want to control when objects are released. - doing interop is inherently unsafe, but we want to keep a .NET-like programming whenever possible. The generated code serves a similar purpose to the CsWin32 project, but the final generated code and the net result (how we use it as a caller) are quite different.
See the main README for the samples and for the DirectN.Extensions conventions.
| Product | Versions 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. |
-
net10.0
- No dependencies.
NuGet packages (9)
Showing the top 5 NuGet packages that depend on DirectNAot:
| Package | Downloads |
|---|---|
|
DirectNAot.Extensions
Extensions code for DirectNAOT package: Com utilities, Extension methods, Windows utilities, DXC utilities, etc. |
|
|
WebView2Aot
AOT-Compatible Windows WebView2 interop Code for .NET Core without any dependency on Winforms, WPF, WinUI, or other UI frameworks. |
|
|
ShellN
AOT compatible, low level .NET bindings for the Windows Shell (COM interfaces, PIDLs, related Win32 APIs), built on DirectN. The friendly, object oriented API is in ShellN.Extensions. |
|
|
ShellN.Extensions
A friendly, AOT compatible thin managed layer over some of the Windows Shell namespace APIs, on top of ShellN. Browse and operate the shell as objects with ShellItem, ShellFolder and KnownFolder, invoke the real context menu, read property stores, and watch for shell changes. |
|
|
AOTrino
Electron-like desktop apps on .NET AOT + WebView2, single-exe, Windows x86/x64/ARM64, front-end-framework-agnostic (React/Fluent layers optional). |
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on DirectNAot:
| Repository | Stars |
|---|---|
|
aelyo-softworks/AOTrino
Electron-like desktop apps on .NET AOT + WebView2, single-exe, Windows (x64/x86/ARM64), front-end-framework-agnostic (React/Fluent UI layers optional).
|
| Version | Downloads | Last Updated |
|---|---|---|
| 1.7.1 | 123 | 10/20/2026 |
| 1.7.0 | 2,649 | 9/23/2026 |
| 1.6.9 | 200 | 9/21/2026 |
| 1.6.8 | 143 | 9/20/2026 |
| 1.6.7 | 176 | 9/14/2026 |
| 1.6.6 | 887 | 8/27/2026 |
| 1.6.5 | 514 | 7/20/2026 |
| 1.6.4 | 316 | 7/2/2026 |
| 1.6.3 | 233 | 6/9/2026 |
| 1.6.1 | 137,393 | 4/26/2026 |
| 1.5.2 | 423 | 2/20/2026 |
| 1.5.1 | 237 | 1/4/2026 |
| 1.4.1 | 1,761 | 11/11/2025 |
| 1.4.0 | 630 | 9/17/2025 |
| 1.3.2 | 880 | 7/28/2025 |
| 1.3.1 | 868 | 5/15/2025 |