An Interest In:
Web News this Week
- March 22, 2024
- March 21, 2024
- March 20, 2024
- March 19, 2024
- March 18, 2024
- March 17, 2024
- March 16, 2024
Suppress runtime relinking at publishing Blazor WebAssembly apps
Backgounds
After installing ".NET WebAssembly build tools", runtime relinking will be performed automatically whenever you publish Blazor WebAssembly apps in the "Release" configuration.
Runtime relinking reduces the size of "dotnet.wasm" by trimming unused runtime code.
That size reduction will contribute download speed of Blazor WebAssembly apps.
See also following links for more details.
However, runtime relinking will take a bit long time for publishing.
Of course, this will not matter for almost developers.
But in some rare cases, taking time for runtime relinking annoys developers, particularly when they investigate a problem involved with the publishing process.
Solution
Fortunately, we can suppress runtime relinking manually.
What we have to do is just specifying the "UsingBrowserRuntimeWorkload" MSBuild property to "false".
For example, you can do that with the command line arguments of dotnet publish
command.
dotnet publish -c:Release -p:UsingBrowserRuntimeWorkload=false
That command behaves like ".NET WebAssembly build tools" is not installed, so the publishing process finishes faster than the case that runtime relinking is performed.
Limitation
Setting the "UsingBrowserRuntimeWorkload" MSBuild property to "false" is available only when the Blazor WebAssembly project doesn't use the "Native Dependency" feature.
If the Blazor WebAssembly project depends on the "Native Dependency" feature, the building and publishing process should be failed.
Original Link: https://dev.to/j_sakamoto/suppress-runtime-relinking-at-publishing-blazor-webassembly-apps-mc1
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To