dotnet-aot-compat

Resolve IL trim and AOT analyzer warnings in .NET projects.

Updated May 28, 2026
One-click install
npx skills add https://github.com/ojrojas/AgentsInstructions --skill dotnet-aot-compat-ojrojas
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dotnet-aot-compat
Source: https://github.com/ojrojas/AgentsInstructions/tree/main/.claude/skills/dotnet-upgrade/skills/dotnet-aot-compat
Command: npx skills add https://github.com/ojrojas/AgentsInstructions --skill dotnet-aot-compat-ojrojas

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill addresses the challenge of making .NET projects compatible with Native AOT (Ahead-of-Time) compilation and trimming, by systematically resolving IL trim/AOT analyzer warnings.

Core Features & Use Cases

  • IL Warning Resolution: Resolves common IL warnings (IL2026, IL2070, IL2067, IL2072, IL3050) for AOT compatibility.
  • DynamicallyAccessedMembers Annotations: Adds annotations to ensure reflection code is AOT-safe.
  • IsAotCompatible Configuration: Enables AOT analysis in .NET projects targeting net8.0 or later.
  • Use Case: Ideal for developers who need to ensure their .NET projects are AOT-compatible and free of trimming warnings after upgrading to net8.0 or later.

Quick Start

Run the dotnet-aot-compat skill on your .NET project to resolve AOT and trimming warnings.

Frequently Asked Questions about dotnet-aot-compat

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

FAQPage Schema
How do I fix IL2026 and IL2070 warnings for .NET Native AOT compatibility?

To fix IL2026, IL2070, IL2067, IL2072, and IL3050 warnings for .NET Native AOT compatibility, you need to add DynamicallyAccessedMembers annotations to reflection code so the trimmer can statically analyze usage. This ensures your code is AOT-safe.

What is the best way to make a .NET project trimming compatible after upgrading to net8.0?

Making a .NET project trimming compatible after upgrading to net8.0 involves configuring IsAotCompatible in the project file to enable analysis, then resolving generated IL warnings by adding required DynamicallyAccessedMembers annotations to types and members.

Why does enabling IsAotCompatible generate IL trim warnings in my .NET project?

Enabling IsAotCompatible generates IL trim warnings because the .NET analyzer detects reflection-based code patterns that the trimmer cannot statically verify, requiring explicit DynamicallyAccessedMembers annotations to guarantee AOT execution safety.

Can I use DynamicallyAccessedMembers annotations to resolve IL3050 warnings?

Yes, you can use DynamicallyAccessedMembers annotations to resolve IL3050 warnings by explicitly declaring the accessed members for reflection APIs, providing the static analysis required to ensure AOT compatibility and prevent trimming issues.

Do I need to configure IsAotCompatible for .NET projects targeting net8.0 or later?

Yes, configuring IsAotCompatible is required for .NET projects targeting net8.0 or later to enable the AOT analysis that identifies trimming warnings and ensures your application is fully compatible with Native AOT compilation.