Skip to content

Blazor WASM produces larger binaries with dotnet 9 compared to dotnet 8, even with WasmStripILAfterAOT=true #110143

@iSeiryu

Description

@iSeiryu

Related discussion: #92238 (comment)

Since that issue was closed I'm opening a new one.

> dotnet --info
.NET SDK:
 Version:           9.0.100
 Commit:            a2bc464e40
 Workload version:  9.0.100-manifests.6bf02610
 MSBuild version:   17.12.7+a2bc464e4

My .csproj

<PropertyGroup>
  <TargetFramework>net9.0</TargetFramework>
  <Nullable>enable</Nullable>
  <ImplicitUsings>enable</ImplicitUsings>
  <InvariantGlobalization>true</InvariantGlobalization>
  <BlazorEnableTimeZoneSupport>false</BlazorEnableTimeZoneSupport>
  <BlazorWebAssemblyPreserveCollationData>false</BlazorWebAssemblyPreserveCollationData>
  <WasmExceptionHandling>true</WasmExceptionHandling>
  <WasmSIMD>false</WasmSIMD>
</PropertyGroup>

Publish command

dotnet publish UI.csproj -c Release -p:RunAOTCompilation=true -p:WasmStripILAfterAOT=true

The size of dotnet.native.wasm.gz on:

  • dotnet 8 with WasmStripILAfterAOT=false - 3.7MB
  • dotnet 8 with WasmStripILAfterAOT=true - 2.5MB (but the app fails to launch)
  • dotnet 9 with WasmStripILAfterAOT=true - 4MB

You can find a published app here:
https://iseiryu.github.io/blazor-aot
https://github.com/iSeiryu/iseiryu.github.io/tree/main/blazor-aot
Source code:
https://github.com/iSeiryu/blazor-wasm-experiments

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions