The size of a Blazor WebAssembly application is important to reduce the loading time. Indeed, like any website, the page including all resources must be loaded before the user can use your application. If there are less things to download, it should load faster. It also reduces the data transfer on the server, so it reduces the hosting costs.

#Removing unused code using the Linker

The .NET framework contains lots of types and methods. This is great when developing. However, this means that DLL are bigger which is not great as there are larger to download. Linking a Blazor WebAssembly application reduces the application’s size by removing unused code in the application’s binaries.

By default, the linker is enabled when building in Release configuration:

dotnet publish --configuration Release

The following chart shows the size of the _framework folder of a Blazor WebAssembly application for each compression algorithm with the linker enabled or not. This values may differ for your application as it depends on which features it uses. So, this is just a indication to show how useful the linker is:

#blazor #.net #asp.net core #web

Optimizing a Blazor WebAssembly application size - Gérald Barré
19.50 GEEK