Configure the Linker for Blazor
By Luke Latham
Blazor performs Intermediate Language (IL) linking during a Release build to remove unnecessary IL from the app's output assemblies.
Control assembly linking using either of the following approaches:
- Disable linking globally with a MSBuild property.
- Control linking on a per-assembly basis with a configuration file.
Disable linking with a MSBuild property
Linking is enabled by default in Release mode when an app is built, which includes publishing. To disable linking for all assemblies, set the
<BlazorLinkOnBuild> MSBuild property to
false in the project file:
<PropertyGroup> <BlazorLinkOnBuild>false</BlazorLinkOnBuild> </PropertyGroup>
Control linking with a configuration file
Control linking on a per-assembly basis by providing an XML configuration file and specifying the file as a MSBuild item in the project file:
<ItemGroup> <BlazorLinkerDescriptor Include="Linker.xml" /> </ItemGroup>
For more information, see IL Linker: Syntax of xml descriptor.
Send feedback about: