dotnet-trimming

Configure .NET 8+ projects for trim-safe applications and libraries.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps developers ensure their .NET applications and libraries are compatible with the .NET trimming process, reducing application size and improving performance by removing unused code.

Core Features & Use Cases

  • Annotation: Apply attributes like [RequiresUnreferencedCode] and [DynamicallyAccessedMembers] to guide the trimmer.
  • Preservation: Use ILLink descriptors to explicitly preserve types and members that reflection might otherwise remove.
  • Diagnostics: Configure TrimmerSingleWarn=false for detailed warnings and use IsTrimmable for libraries.
  • Use Case: A library author wants to ensure their library can be safely included in a trimmed application. They would add IsTrimmable=true to their project and annotate any reflection-based APIs.

Quick Start

Configure your application to enable trim analysis during development by setting EnableTrimAnalyzer=true and TrimmerSingleWarn=false in your .csproj file.

Frequently Asked Questions about dotnet-trimming

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

FAQPage Schema
How do I fix IL2xxx warnings when publishing a trimmed .NET application?

Fix IL2xxx trim warnings by applying trimming annotations like `[RequiresUnreferencedCode]` and `[DynamicallyAccessedMembers]` to guide the trimmer, or use ILLink descriptors to explicitly preserve types and members accessed via reflection.

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

Make a .NET library trim-safe by setting `IsTrimmable=true` in the project file and annotating any reflection-based APIs with `[DynamicallyAccessedMembers]` to ensure the trimmer preserves required members.

How do I get detailed trimming diagnostics during development instead of a single warning?

Enable detailed trimming diagnostics during development by setting `EnableTrimAnalyzer=true` and `TrimmerSingleWarn=false` in your .csproj file to surface all IL2xxx warnings individually.

When do I need to use ILLink descriptors in my .NET app?

Use ILLink descriptors when you cannot statically annotate reflection-based code; they provide an XML configuration to explicitly preserve specific types and members that the .NET trimmer would otherwise remove.

Does .NET trimming work with reflection and AOT scenarios?

.NET trimming works with AOT scenarios by removing unused code, but requires explicit guidance via `[RequiresUnreferencedCode]` attributes or ILLink descriptors to prevent runtime failures from reflection.

What are the limitations of using trimming annotations for reducing application size?

Trimming annotations cannot dynamically resolve runtime reflection patterns; you must manually ensure all dynamically accessed types are preserved using descriptors or attributes to avoid breaking application functionality.