Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

codegen-init

gumcli codegen-init <project.gumj> [--force] [--csproj <path>]

Auto-configures code generation settings for a Gum project by locating the nearest .csproj file above the .gumj directory. Writes a ProjectCodeSettings.codsj settings file next to the .gumj.

Most projects do not need to run codegen-init explicitly. The codegen command auto-detects settings and writes them automatically if they are missing. Run codegen-init when you want to review or confirm the detected configuration before running codegen.

Options

  • <project.gumj> — Path to the .gumj or .gumx project file

  • --force — Overwrite an existing ProjectCodeSettings.codsj without prompting

  • --csproj <path>: Use this .csproj instead of searching for one. Gum records it as CsprojPath in the settings, so codegen reads this .csproj to detect the Gum runtime version and the C# version. Use it when the .csproj is not above the .gumj, or when a folder has several and the game is not Assembly-CSharp.csproj or the shortest name.

What It Detects

  • Walks up from the .gumj directory to find the nearest .csproj

  • If that folder has several .csproj files, uses Assembly-CSharp.csproj, then the shortest name

  • Derives CodeProjectRoot as a relative path from the .gumj directory to the .csproj directory

  • Extracts RootNamespace from the .csproj, falling back to the .csproj filename (with ., -, and spaces replaced by _)

  • Sets OutputLibrary to GumForms (shown as Gum Forms in the Code tab), the preferred output for every runtime including MonoGame, KNI, FNA, Skia, and Raylib

  • For a Unity project (Assembly-CSharp.csproj next to an Assets folder), sets GeneratedCodeFolder to Assets/, because Unity compiles only code under Assets

--csproj recording CsprojPath, and the Unity Assets/ default, are available in October 2026, or now if building Gum from source.

Examples

Output on success:

Exit Codes

Code
Meaning

0

Settings written successfully

2

.csproj not found, settings file already exists (without --force), or the project file was not found

Last updated

Was this helpful?