Simple project which enables experimental web export support for C# projects on Windows.
Visit the Releases for a pre-built binary for Windows.
More information is in the release notes.
Warning
Games exported for the web lack support for some features.
Does not support GDExtensions due to the .NET runtime being built without position-independent code.
From the raulsntos PR:
- Globalization doesn't work, so for now we're always enabling invariant mode.
- (...) some BCL APIs will not work (i.e.: crypto APIs)
Tip
If you are uploading to itch.io - xr0gu3:
(don't forget to enable SharedArrayBuffer support on itch project dashboard).
-
The
.csprojTargetFrameworkmust benet9.0, i.e.,<TargetFramework>net9.0</TargetFramework>.- You will need the .NET 9.0 SDK installed.
-
Your project must include a
Program.cscontaining at least one top-level statement.- The simplest is a
Program.cssimply containing{}. (Sample file included.)
- The simplest is a
-
Done automatically by the included
install.bat:- Copy the included
web_release.zipandweb_debug.zipfiles to%AppData%\Godot\export_templates\<version>.<status>.monoas well as the includednugetfolder to%AppData%\NuGet\nuget(or a valid NuGet source). - The .NET workload
wasm-toolsmust be installed.
- Copy the included
Tip
If you are using self-contained mode, you will need to copy the web export templates to the editor_data\export_templates\<version>.<status>.mono folder.
Note
You may need to add these lines to your .csproj (before the </Project>):
<ItemGroup> <TrimmerRootAssembly Include="System.Private.CoreLib" /> <TrimmerRootAssembly Include="System.Runtime" /> </ItemGroup> Exporting for the web requires the .NET workload wasm-tools to be installed.
The included install.bat will attempt to install wasm-tools for your highest installed .NET SDK as well as .NET 9.0.
This is installed via the command line dotnet workload install wasm-tools.
You can use a global.json (sample file included) to control the .NET SDK version used.
- raulsntos: For their pull request implementing built-in editor support.
- xr0gu3: For providing a docker image and example repo.
In addition to their changes, I've added a change to how export templates are generated based upon the fix in xr0gu3's docker build.
This changes the js file in the template so that you can export directly from the editor with no post-export changes needed.
Custom build of godot here: ComplexRobot/godot/dotnet/mono-static-linking
It is the latest stable version of godot with the PR by raulsntos merged in. (Plus a small change added by xr0gu3.)