Creating a New Project
Create and run a complete 2dog project without installing a tool:
dnx 2dog new MyGame
cd MyGame
dotnet run --project MyGame.2dog2dog new asks which hosts to include. Pass --desktop, --web, --tests, --winforms, or --non-interactive to skip the prompts.
Already have a Godot project? Use 2dog add instead. It creates the same layout around your existing content.
Using dotnet new
The same project template ships in the 2dog NuGet package:
dotnet new install 2dog
dotnet new 2dog -n MyGame
cd MyGame
dotnet run --project MyGame.2dogThe generated project references the required 2dog packages; there is no separate SDK to install.
What You Get
MyGame/ # Godot project root and solution root
├── project.godot
├── MyGame.csproj # Godot.NET.Sdk game project
├── MyGame.slnx
├── main.tscn
├── export_presets.cfg
├── global.json # included with the web host
├── MyGame.2dog/ # generic host
├── MyGame.web/ # browser host (holds TwoDogWebBoot.cs)
├── MyGame.tests/ # xUnit tests
├── .editorconfig
└── .gitignoreEach host folder contains .gdignore, so the Godot editor, importer, and exporter skip it. The game project also excludes host sources from its compile globs.
See Hosts for the shared host contract and each generated host's anatomy. See Project Layout for how the nested projects fit together.
Choose Hosts
The full template includes desktop, browser, and test hosts. To leave optional hosts out, or to opt into the Windows-only WinForms host:
dotnet new 2dog -n MyGame --tests false
dotnet new 2dog -n MyGame --web false
dotnet new 2dog -n MyGame --tests false --web false
dotnet new 2dog -n MyGame --winforms true| Parameter | Default | Description |
|---|---|---|
-n, --name | required | Project name |
--tests | true | Include MyGame.tests with xUnit and 2dog.xunit |
--web | true | Include the MyGame.web browser host |
--winforms | false | Include the MyGame.winforms WinForms host (Windows-only at runtime) |
--skipRestore | false | Skip automatic package restore |
--twodogVersion | current release | 2dog package version |
--nativesVersion | current release | Native platform package version |
--godotVersion | current release | Godot.NET.Sdk version |
Work with the Project
From MyGame/:
dotnet build
dotnet run --project MyGame.2dog
dotnet run --project MyGame.2dog -c ReleaseUse the Godot editor normally; the project root is a regular Godot project. C# scripts belong in that root and compile into MyGame.csproj, which every host references.
For tests, see Testing. For browser prerequisites, publishing, serving, and platform limits, see Web / Browser. Publishing requires:
dotnet workload install wasm-tools
dotnet publish MyGame.webThe rest of the solution builds without wasm-tools; browser publishing is an explicit step.
Manage the Template
dotnet new update
dotnet new uninstall 2dogIf dotnet new 2dog is not found, check dotnet new list and reinstall with dotnet new install 2dog.