Skip to content

MSBuild Configuration ​

Set host properties inside a <PropertyGroup> in its .csproj. Put shared settings in Directory.Build.props. Project settings override shared values; command-line properties (-p:Name=value) override project settings. Omitted 2dog properties use their documented defaults.

Global Properties ​

PropertyDefaultPurpose
GodotProjectDirNoneDirectory containing project.godot; enables resource import and is embedded for Engine.ResolveProjectDir()
TwoDogVariantdebug in Debug, editor in Editor, release otherwiseDesktop/Android native variant; explicit settings override the default. Android does not support editor; browser hosts use TwoDogWebVariant
TwoDogRemoveDuplicateGodotAnalyzersfalseRemoves duplicate analyzers from a host that also references a Godot.NET.Sdk game project

For a host nested directly inside the Godot project:

xml
<PropertyGroup>
  <GodotProjectDir>..</GodotProjectDir>
  <TwoDogRemoveDuplicateGodotAnalyzers>true</TwoDogRemoveDuplicateGodotAnalyzers>
</PropertyGroup>

GodotProjectDir is resolved relative to the project file and embedded as an absolute path. The game project keeps its Godot source generator; only the host should remove duplicate analyzers. Blazor clients are nested an extra level and normally use ../...

See Build Variants for native selection and Resource Import for import controls, including TwoDogAutoImport, TwoDogRequireImport, and GodotEditor.

Packages and Versions ​

Package versions begin with the embedded Godot version. Pin manual references to your project's Godot line, for example Version="4.7.2.*", so NuGet does not silently select a newer engine line. Scaffolded projects keep versions in one block of the root Directory.Build.props:

xml
<PropertyGroup Label="2dog">
  <TwoDogVersion>4.7.2.106</TwoDogVersion>
  <TwoDogNativesVersion>4.7.2.19</TwoDogNativesVersion>
  <TwoDogGodotVersion>4.7.2</TwoDogGodotVersion>
  <!-- TwoDogAvaloniaVersion, TwoDogWindowsAppSdkVersion, TwoDogAspNetCoreVersion -->
</PropertyGroup>

Hosts reference those properties:

xml
<PackageReference Include="2dog.engine" Version="$(TwoDogVersion)"/>
<PackageReference Include="2dog.browser-wasm" Version="[$(TwoDogNativesVersion)]"/>

2dog update rewrites the version block and the game project's Godot.NET.Sdk version, which cannot come from a property. 2dog doctor reports remaining literal versions and mismatched Godot lines.

2dog.engine references the desktop meta packages 2dog.win-x64, 2dog.linux-x64, and 2dog.osx-arm64. Their targets select the native for the build or publish platform. Each pins the release, debug, and editor packages; the selected library is copied as libgodot-<variant>.dll, .so, or .dylib. 2dog.browser-wasm pins both release and debug browser natives.

Native AOT ​

Generic, Avalonia, and WinUI hosts support PublishAot=true with debug or release natives. The editor variant loads GodotTools at runtime and cannot use Native AOT. WinForms does not support trimming or Native AOT.

Desktop Native AOT requires the platform's native toolchain: Visual Studio C++ build tools on Windows, clang and zlib1g-dev on Linux, or Xcode command-line tools on macOS. Publish on the operating system you target; see the .NET prerequisites.

2dog preserves GodotSharp and the game assembly for reflection. Root other assemblies that are only accessed through reflection:

xml
<ItemGroup>
  <TrimmerRootAssembly Include="MyLibrary"/>
</ItemGroup>

Android has experimental Native AOT with NDK requirements and different trimmer roots. Browser hosts use Mono's AOT compiler through RunAOTCompilation, described in their host references.

MSBuild Runtimes ​

Core, Full, and Mono describe the runtime executing MSBuild. They are independent of your project's TargetFramework, build Configuration, and the runtime used by your published app. Windows builds can use Core or Full.

MSBuildRuntimeTypeBuild tool
CoreMSBuild from the .NET SDK: dotnet build, dotnet publish, or dotnet msbuild
Full.NET Framework MSBuild, such as Visual Studio's MSBuild.exe
MonoLegacy MSBuild running on Mono

MSBuild sets this reserved property automatically. To inspect the runtime used by a command:

bash
dotnet msbuild MyGame.2dog/MyGame.2dog.csproj -getProperty:MSBuildRuntimeType

Use the .NET 10+ SDK for 2dog's CLI workflows. Currently, Web and WebXR precompression runs only under Core MSBuild; Full and Mono skip it even when explicitly enabled. The current inline task depends on Core's compression APIs.