dotnet-aot-compat
Make .NET projects compatible with Native AOT and trimming by systematically resolving IL trim/AOT analyzer warnings. USE FOR: making projects AOT-compatible, fixing trimming warnings, resolving IL warnings (IL2026, IL2070, IL2067, IL2072, IL3050), adding DynamicallyAccessedMembers annotations, enabling IsAotCompatible. DO NOT USE FOR: publishing native AOT binaries, optimizing binary size, replacing reflection-heavy libraries with alternatives.
npx skills add dotnet/skills --skill dotnet-aot-compat --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# dotnet-aot-compat Make .NET projects compatible with Native AOT and trimming by systematically resolving all IL trim/AOT analyzer warnings. ## When to Use This Skill - **"Make this project AOT-compatible"** - **"Fix trimming warnings"** or **"fix IL warnings"** - **"Resolve IL2070 / IL2067 / IL2072 / IL2026 / IL3050 warnings"** - **"Add DynamicallyAccessedMembers annotations"** - **"Enable IsAotCompatible in my .csproj"** - **"My project has trim analyzer warnings after upgrading to net8.0"** - **"Annotate reflection code for the trimmer"** ## When Not to Use This Skill Do not use this skill when the project exclusively targets .NET Framework (net4x), which does not support the trim/AOT analyzers. ## Prerequisites An existing .NET project targeting net8.0 or later (or multi-targeting with at least one net8.0+ TFM) and the corresponding .NET SDK installed. ## Background: What AOT Compatibility Means Native AOT and the IL trimmer perform static analysis to determine what code is reachable. Reflection can break this analysis because the trimmer can't see what types/members are accessed at runtime. The `IsAotCompatible` property enables analyzers that flag these issues as build warni
- When to Use This Skill
- When Not to Use This Skill
- Prerequisites
- Background: What AOT Compatibility Means
- Critical Rules
- ❌ Never suppress warnings incorrectly
- 💡 Preferred approaches
- Annotation flow is key
- Step-by-Step Procedure
- Step 1: Enable AOT analysis in the .csproj
- Step 2: Build and collect warnings
- Step 3: Triage warnings by code (do NOT read every file)
- Step 4: Fix warnings iteratively (innermost first)
- Step 5: Rebuild and repeat
dotnet build <project.csproj> -f <net8.0-or-later-tfm> --no-incremental 2>&1 | grep 'IL[0-9]\{4\}'
grep -rl 'JsonSerializer\.\(Serialize\|Deserialize\)' src/ --include='*.cs'
dotnet build <project.csproj> # builds all TFMsWhat does the dotnet-aot-compat skill do?
Make .NET projects compatible with Native AOT and trimming by systematically resolving IL trim/AOT analyzer warnings. USE FOR: making projects AOT-compatible, fixing trimming warnings, resolving IL warnings (IL2026, IL2070, IL2067, IL2072, IL3050), adding DynamicallyAccessedMembers annotations, enabling IsAotCompatible. DO NOT USE FOR: publishing native AOT binaries, optimizing binary size, replacing reflection-heavy libraries with alternatives.
How do I install it?
Run `npx skills add dotnet/skills --skill dotnet-aot-compat --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From dotnet/skills, a repository with 4,927 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
