AspNetCore.Docs/aspnetcore/blazor/host-and-deploy/configure-trimmer.md

1.8 KiB

title author description monikerRange ms.author ms.custom ms.date no-loc uid
Configure the Trimmer for ASP.NET Core Blazor guardrex Learn how to control the Intermediate Language (IL) Linker (Trimmer) when building a Blazor app. >= aspnetcore-5.0 riande mvc 09/14/2020
ASP.NET Core Identity
cookie
Cookie
Blazor
Blazor Server
Blazor WebAssembly
Identity
Let's Encrypt
Razor
SignalR
blazor/host-and-deploy/configure-trimmer

Configure the Trimmer for ASP.NET Core Blazor

By Pranav Krishnamoorthy

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.

Additional resources