dotnet-trimming

Guide .NET 8+ trimming with annotations and ILLink descriptors.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps developers reduce the size of their .NET applications and libraries by removing unused code, leading to faster startup times and smaller deployment packages.

Core Features & Use Cases

  • Trim-safe Development: Guides on using .NET 8+ trimming annotations and ILLink descriptors.
  • Warning Resolution: Provides fixes for IL2xxx/IL3xxx warnings related to trimming and AOT compilation.
  • Library Authoring: Explains how to make .NET libraries compatible with trimming.
  • Use Case: Ensure your Blazor WebAssembly application or self-contained console app is as small as possible by identifying and removing dead code before deployment.

Quick Start

Use the dotnet-trimming skill to understand how to set the IsTrimmable property for a library project.

Frequently Asked Questions about dotnet-trimming

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

FAQPage Schema
How do I reduce the size of my .NET application by removing unused code?

You can reduce .NET application size through trimming, which removes unused code to produce faster startup times and smaller deployment packages. This Skill guides you in setting the `IsTrimmable` property and using ILLink descriptors.

How do I resolve IL2xxx and IL3xxx trimming warnings in .NET 8+?

Resolving IL2xxx and IL3xxx warnings involves applying .NET 8+ trimming annotations to ensure your code is trim-safe. This Skill provides specific fixes for these warnings encountered during AOT compilation and library compatibility checks.

What is the best way to make a .NET library compatible with trimming?

Making a .NET library compatible with trimming requires using trim-safe development practices like applying trimming annotations and ILLink descriptors. This ensures your library does not break when unused code is removed.

Does .NET trimming work with Blazor WebAssembly and self-contained console apps?

.NET trimming works effectively with Blazor WebAssembly and self-contained console apps to minimize deployment size. It identifies and removes dead code before deployment, optimizing performance for these specific use cases.

What are the limitations of using trimming for AOT compilation in .NET?

A limitation of trimming for AOT compilation in .NET is potential library compatibility issues if code is not trim-safe. You must resolve IL2xxx and IL3xxx warnings and apply proper annotations to prevent runtime failures from removed dependencies.

Why do I need to use trimming annotations for my .NET 8+ application?

You need trimming annotations for .NET 8+ applications to explicitly mark code as trim-safe, preventing the ILLink analyzer from incorrectly removing necessary methods. This ensures application stability when reducing package size.