Configure the Trimmer for ASP.NET Core Blazor
Blazor WebAssembly performs Intermediate Language (IL) trimming to reduce the size of the published output.
Trimming an app optimizes for size but may have detrimental effects. Apps that use reflection or related dynamic features may break when trimmed because the trimmer doesn't know about dynamic behavior and can't determine in general which types are required for reflection at runtime. To trim such apps, the trimmer must be informed about any types required by reflection in the code and in packages or frameworks that the app depends on.
To ensure the trimmed app works correctly once deployed, it's important to test published output frequently while developing.
Trimming for .NET apps can be disabled by setting the
PublishTrimmed MSBuild property to
false in the app's project file:
<PropertyGroup> <PublishTrimmed>false</PublishTrimmed> </PropertyGroup>
Additional options to configure the trimmer can be found at Trimming options.