2dog add
Adds hosts to an existing Godot project, in place. Run it again to add more hosts, including a second host of the same kind.
Without host flags it asks which hosts to add. Host flags skip that wizard; on terminals, a missing workload (wasm-tools, android) can still be offered. -y runs unattended.
2dog add [path] [hosts] [options]| Argument | Meaning |
|---|---|
path | Directory containing project.godot; defaults to the current directory |
Hosts
Any host flag, repeatable. Unattended without one: generic and browser, minus the --no-<host> ones. Add tests explicitly with --xunit, --gdunit or --nunit. Existing hosts are recognized and skipped.
Adding a test host creates a root global.json that selects Microsoft.Testing.Platform when none exists. An existing global.json is never edited; 2dog warns when it does not select it.
The new hosts are built for the running tool's versions, so the game project's Godot.NET.Sdk and an existing 2dog version block in Directory.Build.props are raised to them in the same run (never lowered), as 2dog update would. A move across Godot lines is called out: install the matching editor and open the project once.
Migrating an existing .sln to .slnx keeps it as a numbered .sln.old backup.
Options
| Option | Effect |
|---|---|
-n, --name <name> | Base name override for the scaffolded files; letters, digits, . and _ survive, - becomes _, C# keywords and leading digits get a _ prefix |
--rename <NewName> | Rename a .NET project name that contains spaces, then scaffold; only before any hosts exist |
--dry-run | Print the plan; change nothing |
--force | Overwrite scaffolded files that exist; never deletes |
--double-precision [true|false] | Select matching double precision bindings and natives for the game and all hosts; false selects single precision |
--web-threads [true|false] | Enable experimental multithreading for Web and Blazor clients; serving requires COOP/COEP headers |
--no-restore | Skip the final dotnet restore |
--install-wasm-tools | Install missing wasm-tools for browser hosts without an installation prompt |
--install-android-workload | Install the missing android workload for Android hosts without an installation prompt |
Omitting the build settings preserves the project's; see build options for their requirements.
Plus the global and output options.
Workload offers apply only to newly selected hosts. --no-restore skips them; the install flags work in CI too. --dry-run never checks or installs workloads.
A failed restore returns exit code 2 and keeps the created files. The tool explains recognized errors; fix the cause and run dotnet restore again.
Examples
Install the .NET 10 SDK, then add and run a generic .NET host in your existing Godot project:
cd path/to/MyGame
dnx 2dog add --generic
dotnet run --project MyGame.2dog2dog creates a nested host project that runs your game. Keep editing scenes and scripts in Godot as usual. GDScript projects work too.
Choose hosts interactively, or supply host flags:
2dog add # interactive, here
2dog add --generic MyGame.editor # a second generic host, named
2dog add --android # an Android host
2dog add --xunit # an xUnit test host
2dog add --gdunit # a GDScript test host (MTP)
2dog add --nunit # an NUnit test host
2dog add path/to/project --no-web
2dog add --rename MyGame # fix a spaced .NET name firstSee Hosts for host types and Project Layout for generated files. For a new project, use 2dog new.