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.