Configure the Trimmer for ASP.NET Core Blazor
Note
This isn't the latest version of this article. To switch to the latest, use the ASP.NET Core version selector at the top of the table of contents.
If the selector isn't visible in a narrow browser window, widen the window or select the vertical ellipsis (⋮) > Table of contents.
This article explains how to control the Intermediate Language (IL) Trimmer when building a Blazor app.
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
<SuppressTrimAnalysisWarnings>
property tofalse
in the project file. - Control symbol trimming and debugger support.
- Set Trimmer features for trimming framework library features.
Additional resources
Feedback
Submit and view feedback for