Publishing a game
A game is published with dotnet publish, once for each platform it runs on. The publish folder
holds the game, its packages and the native libraries for that platform.
Self-contained or framework-dependent
A self-contained publish includes the .NET runtime, so the player needs nothing installed. It is larger, and it is the one to use for players:
dotnet publish -c Release -r win-x64 --self-contained
dotnet publish -c Release -r linux-x64 --self-contained
dotnet publish -c Release -r osx-arm64 --self-contained
A framework-dependent publish leaves the runtime out, so the player needs the .NET 10 runtime
installed. Use --self-contained false:
dotnet publish -c Release -r win-x64 --self-contained false
Publish into a folder of your own with -o, for example -o publish/win-x64. The folder is what
you zip up, or what an installer packs.
Platforms
Each package carries the native libraries for some platforms. The publish gets the ones for the
runtime identifier it names (-r):
| Runtime identifier | SDL3 (BSGameLib.Sdl3.Native) |
MoltenVK (BSGameLib.MoltenVK.Native) |
QUIC (BSGameLib.MsQuic.Native) |
|---|---|---|---|
win-x64, win-arm64 |
Included | macOS only | Not included: .NET provides QUIC on Windows |
linux-x64 |
Included | macOS only | Included |
linux-arm64 |
Included | macOS only | Included |
osx-arm64 |
Included | Included | Included |
osx-x64 |
Included | Included | Not included |
Other runtime identifiers, such as linux-musl-x64, get none of the libraries.
Where a library is not included, install it on the system instead. QUIC on osx-x64 needs a
system msquic.
On Linux, the QUIC library is copied beside the game's files. A self-contained publish loads that copy. A framework-dependent publish does not: the runtime loads the msquic installed on the system, so the player needs one there. See the server does not start.
Without a runtime identifier
A publish with no -r copies the libraries for every platform, under a runtimes folder in the
output. The runtime picks the ones it needs, but the folder is large. Name a runtime identifier to
get only that platform's libraries.
Trimming
Trimming is not supported. Leave PublishTrimmed off, which is the default. The engine finds
services, view-model properties and network packets by reflection, and a trimmed-away member fails
only when the game reaches it.
Shaders
Shaders are compiled to SPIR-V when the game builds, on the machine that builds it, so a game can be published for another platform from wherever it is built. The players' machines need no shader compiler. See Shaders.
Licences
The publish folder has a licenses folder. Licences in your game says which
licence files it holds.