AvaloniaUI / Avalonia

Develop Desktop, Embedded, Mobile and WebAssembly apps with C# and XAML. The most popular .NET UI client technology
https://avaloniaui.net
MIT License
26.04k stars 2.25k forks source link

AvaloniaUI Web assembly publish size is too bigger than stand blazor web assembly project #17490

Closed felixf4xu closed 1 week ago

felixf4xu commented 1 week ago

Describe the bug

I created 2 web assembly project, one is blazor web assembly, by dotnet new blazorwasm -o BlazorWasm, the other is avaloniaui web browser project, by dotnet new avalonia.xplat -o AvaloniaX.

Both are using this configurations to dotnet publish:

    <RunAOTCompilation>true</RunAOTCompilation>
    <WasmStripILAfterAOT>true</WasmStripILAfterAOT>
    <InvariantGlobalization>true</InvariantGlobalization>
    <InvariantTimezone>true</InvariantTimezone>

Then I check the publish folder:

avaloniaui web browser project:

dotnet.native....wasm: 28.3M dotnet.native....wasm.br: 6.1M

blazor web assembly project:

dotnet.native....wasm: 11.1M dotnet.native....wasm.br: 2.5M

Why the size is so bigger than blazor web assembly project?

To Reproduce

dotnet new avalonia.xplat -o AvaloniaX

Expected behavior

dotnet.native.wasm should be similar to blazor wasm project

Avalonia version

11.1.0

OS

WebAssembly

Additional context

.net9