dotnet-aot-architecture

Guide .NET 8+ application design for Native AOT compilation using source generators.

10|Updated Jan 28, 2026
One-click install
npx skills add https://github.com/AGIBuild/Agibuild.Fulora --skill dotnet-aot-architecture
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dotnet-aot-architecture
Source: https://github.com/AGIBuild/Agibuild.Fulora/tree/main/.cursor/skills/dotnet-aot-architecture
Command: npx skills add https://github.com/AGIBuild/Agibuild.Fulora --skill dotnet-aot-architecture

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses the challenges of designing and building .NET applications that are optimized for Native AOT compilation, ensuring compatibility and performance by avoiding reflection-based patterns.

Core Features & Use Cases

  • Source Generators: Replaces reflection with compile-time code generation for DI, serialization, and logging.
  • AOT-Safe DI: Promotes explicit service registration over assembly scanning.
  • Serialization: Guides choices towards AOT-compatible serializers like System.Text.Json with source generation.
  • Use Case: Migrating an existing .NET application to Native AOT by identifying and refactoring reflection-heavy components to use source generators and explicit configurations.

Quick Start

Apply AOT-first design patterns to your .NET application by replacing reflection with source generators.

Frequently Asked Questions about dotnet-aot-architecture

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

FAQPage Schema
How do I design .NET apps for Native AOT compilation without using reflection?

Design .NET apps for Native AOT by replacing reflection with source generators for compile-time code generation, utilizing explicit dependency injection, and adopting AOT-safe serialization.

What is the best way to configure dependency injection for .NET Native AOT?

The best way to configure dependency injection for .NET Native AOT is through explicit service registration, avoiding assembly scanning patterns that rely on reflection at runtime.

How does System.Text.Json serialization work with .NET Native AOT?

System.Text.Json works with .NET Native AOT by utilizing source generation to create AOT-safe serialization contexts at compile-time, eliminating reflection-based serialization overhead.

Can I migrate an existing .NET application to Native AOT?

You can migrate an existing .NET application to Native AOT by identifying reflection-heavy components and refactoring them to use source generators and explicit configurations for .NET 8+.

Why does Native AOT compilation fail with reflection-heavy patterns in .NET?

Native AOT compilation fails with reflection-heavy patterns because ahead-of-time compilation requires static analysis, making dynamic runtime reflection incompatible with trim-safe AOT requirements.

Do I need source generators for .NET 8 Native AOT compatibility?

Yes, you need source generators for .NET 8 Native AOT compatibility to statically generate code for DI, serialization, and logging during compilation instead of relying on runtime reflection.