Configure the Trimmer for ASP.NET Core Blazor
Blazor WebAssembly performs Intermediate Language (IL) trimming to reduce the size of the published output. By default, trimming occurs when publishing an app.
Trimming may have detrimental effects. In apps that use reflection, the Trimmer often can't determine the required types for reflection at runtime. To trim apps that use reflection, the Trimmer must be informed about required types for reflection in both the app's code and in the packages or frameworks that the app depends on. The Trimmer is also unable to react to an app's dynamic behavior at runtime. To ensure the trimmed app works correctly once deployed, test published output frequently while developing.
To configure the Trimmer, see the Trimming options article in the .NET Fundamentals documentation, which includes guidance on the following subjects:
- Disable trimming for the entire app with the
<PublishTrimmed>property in the project file.
- Control how aggressively unused IL is discarded by the Trimmer.
- Stop the Trimmer from trimming specific assemblies.
- "Root" assemblies for trimming.
- Surface warnings for reflected types by setting the
falsein the project file.
- Control symbol trimming and degugger support.
- Set Trimmer features for trimming framework library features.