Adding 2dog to Your Project
The 2dog tool adds .NET hosts to an existing Godot project in place. Your project directory becomes the solution root, while desktop, browser, and test hosts live in nested folders that Godot ignores. Existing game content stays put.
The command and dotnet new template ship together in the 2dog package, separate from 2dog.engine. The FAQ explains why.
Usage
Run it without installing anything (.NET 10+ SDK):
cd path/to/your/godot/project
dnx 2dog addOr install the command globally:
dotnet tool install -g 2dog
2dog addWith a project.godot in the current directory, the tool asks which hosts to add, shows its plan, and waits for confirmation:
2dog 4.7.1 https://2dog.dev
project MyGame (/home/you/games/MyGame)
Which hosts do you want?
> [x] desktop MyGame.2dog your own Main(), runs the game on desktop
[x] browser MyGame.web WebAssembly host, published as a static bundle
[ ] tests MyGame.tests xUnit project driving a headless engineEvery prompt has a flag, so scripts and CI can run unattended:
dnx 2dog add path/to/MyGame --no-web # everything except the web host
dnx 2dog add path/to/MyGame --dry-run # show the plan; change nothingNaming a host option, passing --yes, or passing --non-interactive disables the prompts.
From stock Godot to the browser
dnx 2dog add path/to/MyGame -y
cd path/to/MyGame
dotnet publish MyGame.web # static site in MyGame.web/AppBundle/Publishing requires dotnet workload install wasm-tools. See Web / Browser for the complete publishing guide.
Commands
| Command | Effect |
|---|---|
2dog | Add hosts here, or create a project if there is none |
2dog new [Name] [dir] | Create a new Godot project with 2dog hosts |
2dog add [path] | Add hosts to an existing Godot project |
2dog convert [path] | Alias of add for a project with no hosts yet |
2dog version | Print the tool version and the versions of every package it references |
Options
| Option | Effect |
|---|---|
--desktop [folder] | Add a generic host, optionally in a named folder |
--web [folder] | Add a browser (WebAssembly) host |
--tests [folder] | Add an xUnit test project |
--winforms [folder] | Add a WinForms host (Windows-only; never part of the default set) |
--no-desktop, --no-web, --no-tests | Leave a host out of the default set |
-n, --name <BaseName> | Project name (new) or base-name override |
-o, --output <dir> | Directory for a new project |
-y, --yes | Use the flags and defaults without prompting |
--non-interactive | Same as --yes |
--dry-run | Print planned actions without changing anything |
--force | Overwrite existing scaffolded files; never delete or move files |
--no-restore | Skip the final dotnet restore |
--verbose | Show extra output |
--version | Same as the version command |
Versions
2dog version prints the tool version together with the versions of every package a scaffold references; the dnx 2dog reference shows the output.
--version under dnx
dnx 2dog --version never reaches the tool: --version <VERSION> is dnx's own option and selects which version of the 2dog package to download and run. Use dnx 2dog version to print versions, and dnx 2dog@4.7.1.65 (or the --version option) to run a specific tool version.
Result
The normal generated layout is documented once in Creating a New Project. For an existing project, 2dog creates or updates the same solution and host folders around your content. Then run:
dotnet run --project MyGame.2dog
dotnet test MyGame.tests
dotnet publish MyGame.webProjects without a C# project work too. The tool creates a Godot.NET.Sdk project and configures project.godot; GDScript scenes and scripts continue to run unchanged.
Safety
The tool is incremental. Existing hosts are recognized, existing files are skipped and reported, and a run with nothing to add is a no-op. Use --dry-run before changing anything and --force only when you intend to replace scaffolded files.
It does not:
- move, rename, or delete game content;
- touch version control,
.gitignore, staging, or commits; - overwrite an existing
global.json, even with--force; - guess when multiple root solutions contain the Godot project.
One deliberate migration can occur: a classic .sln is converted to .slnx and removed. An existing root .slnx is reused.
The tool runs dotnet restore unless you pass --no-restore. A wasm-related restore failure is reported as a warning with the command to install wasm-tools.
Requirements
- .NET 10 SDK, also required by
dnx. - The wasm-tools workload only when publishing the browser host:
dotnet workload install wasm-tools.