Quick answer: Godot 4 C# project failing to export to Web with AOT compilation warning? .NET on Web requires AOT for most assemblies - rebuild with PublishAot or use the threaded export.

Web export emits JIT not available; AOT required and produces a non-functional WASM bundle.

Enable PublishAot

<PublishAot>true</PublishAot>

In csproj. Forces AOT for all assemblies. Larger output but compatible with Web.

Mark reflection-using code

AOT trims aggressively. Use [DynamicallyAccessedMembers] on types reached via reflection or they'll be trimmed and crash at runtime.

Or wait for Web .NET maturity

Godot Web .NET is still experimental. For shipping, GDScript exports cleanly to Web; C# is best left to native platforms until support stabilizes.

“Web is the strictest target for .NET. AOT requirements are firm.”

Test Web exports as part of every C# refactor. The class of bug AOT-trimming introduces is exhausting to debug after the fact.