dotnet-native-aot

Publish .NET applications as Native AOT binaries with MSBuild configuration.

1|Updated Feb 22, 2026
One-click install
npx skills add https://github.com/rudironsoni/dotnet-agent-harness --skill dotnet-native-aot-rudironsoni
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dotnet-native-aot
Source: https://github.com/rudironsoni/dotnet-agent-harness/tree/main/.rulesync/skills/dotnet-native-aot
Command: npx skills add https://github.com/rudironsoni/dotnet-agent-harness --skill dotnet-native-aot-rudironsoni

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill streamlines the process of publishing .NET applications as self-contained Native AOT binaries, optimizing for performance and reduced deployment size.

Core Features & Use Cases

  • Native AOT Compilation: Configure MSBuild for PublishAot and related properties.
  • Type Preservation: Utilize ILLink descriptors and [DynamicDependency] attributes to handle reflection.
  • P/Invoke: Ensure compatibility with native libraries using [LibraryImport].
  • Size Optimization: Apply various flags to minimize binary size.
  • Container Deployment: Use runtime-deps base images for efficient containerization.
  • Use Case: Publish a high-performance ASP.NET Core Minimal API as a single, small, self-contained executable for rapid deployment.

Quick Start

Publish the current .NET application as a Native AOT binary for Linux x64.

Frequently Asked Questions about dotnet-native-aot

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I publish a .NET application as a Native AOT binary?

To publish a .NET application as a Native AOT binary, configure MSBuild with the PublishAot property. This enables ahead-of-time compilation, producing a self-contained executable with enhanced performance and a reduced deployment footprint.

What is Native AOT compilation and when should I use it for ASP.NET Core?

Native AOT compilation compiles .NET applications directly to native machine code ahead of execution. Use it for ASP.NET Core Minimal APIs when you need rapid startup, enhanced performance, and smaller self-contained deployment footprints.

Does Native AOT work with reflection and dynamic code in .NET?

Native AOT restricts dynamic code, but you can preserve types using ILLink descriptors and DynamicDependency attributes. This ensures required metadata remains available during ahead-of-time compilation for dynamic dependencies.

How do I ensure P/Invoke compatibility when publishing .NET Native AOT binaries?

Ensure P/Invoke compatibility in Native AOT binaries by using the LibraryImport attribute. This source-generated attribute provides efficient native interop by generating marshalling code at compile time instead of relying on runtime reflection.

What's the best way to optimize binary size for a .NET Native AOT deployment?

Optimize .NET Native AOT binary size by applying specific MSBuild configuration flags to minimize output and using runtime-deps container images. This approach creates efficient self-contained deployments tailored for smaller footprints.

Can I use ASP.NET Core Minimal APIs with .NET 10 Native AOT advancements?

Yes, ASP.NET Core Minimal APIs support Native AOT compilation. The workflow leverages .NET 10 advancements in AOT compilation to publish high-performance APIs as single, small, self-contained executables for rapid deployment.