How can I reduce the size of .NET WebAssembly assets?
14:53 27 Feb 2026

I integrated some of our backend code into the browser so the non-BIazor frontend could call it (to reduce cross-language code duplication), but the Microsoft stuff is huge:

2.9 MB: dotnet.native.f2enx5oows.wasm (that's 2.76 MiB)
1.7 MB: System.Private.CoreLib.d9ssu6hc5y.wasm  
469 kB: (our software)
435 kB: System.Linq.Expressions.au83szdbvw.wasm   
424 kB: System.Text.Json.r8m0aggw0h.wasm  
242 kB: Microsoft.CSharp.o966qslg60.wasm (what even is this)
221 kB: dotnet.native.b3rug6rpk3.js  
199 kB: dotnet.runtime.q5rqv3xrhm.js  
139 kB: (our software)

The big files do not download again during a Ctrl+F5, but if I disable cache, total download size is 7.8 MB larger than the "no C#" version.

My project settings:


  
    net10.0
    true
    enable

    true
    full

    
    <_ExtraTrimmerArgs>--keep-metadata parametername

    
    true
    obj/generated

    true
  

I'm unsure how to tell if the JSON-related stuff is causing trouble; if I change anything about that, everything breaks and the app can't start. Anyone care to comment on how big their .NET-in-browser deployment is?

.net-core dotnet-webassembly