-
Notifications
You must be signed in to change notification settings - Fork 10k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Blazor WASM apps should fully trim Microsoft.Extensions.* assemblies #24634
Comments
Thanks @eerhardt! |
Once complete, does this mean that the Microsoft.AspNetCore.* and Microsoft.Extensions.* assemblies should just get standard TrimMode=Trim behavior? |
My thinking is that only |
* Enable trimming for Microsoft.Extensions packages Fixes #24634 * Update Microsoft.NET.Sdk.BlazorWebAssembly.csproj * Apply suggestions from code review * Fixup test
Nice! |
Today, when publishing a Blazor WASM app, we are telling the ILLinker to trim
Microsoft.Extensions.*
assemblies, but only at a "type granularity" level. Meaning, if some part of the Type is used, preserve the whole Type.aspnetcore/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Microsoft.NET.Sdk.Razor.Components.Wasm.targets
Lines 372 to 377 in 6c35e2e
This causes unnecessary bloat in the produced app because there are types in
Microsoft.Extensions.*
where some unused code is pulling in moreSystem.*
assemblies (e.g. System.Diagnostics.DiagnosticSource.dll), causing even more unused code to be compiled in the app.With the recent work done in Extensions to make them linker-friendly:
we should be able to remove the "type granularity" clauses for these assemblies now that they are linker safe.
Using a recent
rc1
build, I'm seeing the following size savings in IL:cc @SteveSandersonMS @pranavkm @marek-safar
The text was updated successfully, but these errors were encountered: