dotnet-native-aot

Configure MSBuild for publishing .NET applications with Native AOT compilation.

71|10|Updated Feb 11, 2026
One-click install
npx skills add https://github.com/wshaddix/dotnet-skills --skill dotnet-native-aot-wshaddix
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dotnet-native-aot
Source: https://github.com/wshaddix/dotnet-skills/tree/main/skills/dotnet-native-aot
Command: npx skills add https://github.com/wshaddix/dotnet-skills --skill dotnet-native-aot-wshaddix

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill enables the publishing of .NET applications as self-contained, Ahead-Of-Time (AOT) compiled executables, significantly reducing startup time and memory footprint.

Core Features & Use Cases

  • Native AOT Compilation: Configure MSBuild for Native AOT publishing (PublishAot).
  • Type Preservation: Use ILLink descriptors or [DynamicDependency] to handle reflection.
  • Size Optimization: Apply various flags for smaller binary sizes.
  • Use Case: Publish a high-performance ASP.NET Core Minimal API or a console application that starts instantly with minimal resource consumption.

Quick Start

Configure your application's .csproj file to enable Native AOT compilation for publishing.

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 executable?

To publish a .NET application as a Native AOT executable, you configure MSBuild by setting the PublishAot property in your .csproj file. This enables self-contained, ahead-of-time compiled executables that significantly reduce startup time and memory footprint.

Does Native AOT compilation work with ASP.NET Core Minimal APIs?

Yes, Native AOT compilation supports ASP.NET Core Minimal APIs. You can publish high-performance ASP.NET Core Minimal APIs as Native AOT executables that start instantly with minimal resource consumption, specifically targeting .NET 8 and .NET 10 improvements.

How do I handle reflection issues when publishing .NET Native AOT applications?

To handle reflection issues during Native AOT publishing, use ILLink descriptors or the DynamicDependency attribute for type preservation. Diagnostic analyzers for AOT and trimming help identify reflection patterns that require explicit preservation.

What are the limitations of Native AOT compilation for .NET applications?

Native AOT compilation limitations include reflection requiring explicit ILLink descriptors or DynamicDependency attributes, and P/Invoke considerations needing LibraryImport. Dynamic code generation patterns require careful preservation to avoid trimming-related failures during AOT publishing.

Can I optimize binary size when publishing .NET applications with Native AOT?

Yes, you can optimize binary size when publishing .NET Native AOT applications by applying various size optimization flags. These MSBuild configurations help reduce the final executable size of self-contained, ahead-of-time compiled binaries.

What is Native AOT compilation and when do I need it for .NET applications?

Native AOT compilation is a process that publishes .NET applications as self-contained, ahead-of-time compiled executables. You need it when you want to significantly reduce startup time and memory footprint for console applications or ASP.NET Core Minimal APIs.