From 31ae2119616d57a4be1176514b231bad888dfb2a Mon Sep 17 00:00:00 2001 From: Luke Latham <1622880+guardrex@users.noreply.github.com> Date: Tue, 18 Jun 2024 17:17:04 -0400 Subject: [PATCH] Clarify Blazor trim mode (#32884) --- .../blazor/host-and-deploy/configure-trimmer.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/aspnetcore/blazor/host-and-deploy/configure-trimmer.md b/aspnetcore/blazor/host-and-deploy/configure-trimmer.md index 1d7bb9c04d..c9961a0058 100644 --- a/aspnetcore/blazor/host-and-deploy/configure-trimmer.md +++ b/aspnetcore/blazor/host-and-deploy/configure-trimmer.md @@ -18,6 +18,8 @@ Blazor WebAssembly performs [Intermediate Language (IL)](/dotnet/standard/glossa Trimming may have detrimental effects for the published app. In apps that use [reflection](/dotnet/csharp/advanced-topics/reflection-and-attributes/), the IL Trimmer often can't determine the required types for runtime reflection and trim them away. For example, complex framework types for JS interop, such as , might be trimmed by default and not available at runtime for JS interop calls. In these cases, we recommend creating your own custom types instead. The IL 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. +## Configuration + To configure the IL Trimmer, see the [Trimming options](/dotnet/core/deploying/trimming/trimming-options) article in the .NET Fundamentals documentation, which includes guidance on the following subjects: * Disable trimming for the entire app with the `` property in the project file. @@ -28,6 +30,18 @@ To configure the IL Trimmer, see the [Trimming options](/dotnet/core/deploying/t * Control symbol trimming and debugger support. * Set IL Trimmer features for trimming framework library features. +## Default trimmer granularity + +The default trimmer granularity for Blazor apps is `partial`. To trim all assemblies, change the granularity to `full` in the app's project file: + +```xml + + full + +``` + +For more information, see [Trimming options (.NET documentation)](/dotnet/core/deploying/trimming/trimming-options#trimming-granularity). + ## Additional resources * [Trim self-contained deployments and executables](/dotnet/core/deploying/trimming/trim-self-contained)