Skip to content

About

Write your XBOX game in C#, not in P/Invoke. The .NET projection of the Microsoft GDK: Gaming Runtime, XBOX Services and PlayFab as Tasks, events and exceptions. NativeAOT-ready on .NET 8, .NET 10 and netstandard2.0.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

4 stars

Watchers

1 watching

Forks

Repository files navigation

XBOX GDK.NET

License: MIT .NET 8 and 10 netstandard2.0 Microsoft GDK 260404 XBOX Services supported PlayFab supported NativeAOT ready Windows only Visit our Blog Join us on Discord PRs welcome

Write your XBOX game in C#, not in P/Invoke. XBOX GDK.NET is the .NET projection of the Microsoft GDK flat C API, exposing the Gaming Runtime, XBOX Services and PlayFab as ordinary modern C# - Task, IDisposable, events, exceptions and [Flags] enums instead of HRESULTs, raw handles, XAsyncBlocks and two-call size buffers. GDK.Net is the assembly, package and root namespace name, so it is what you see in code; XBOX GDK.NET is the name of the product.

Important

This is source, not a product. The projection is MIT-licensed, but the Microsoft GDK and the PlayFab extension libraries it binds to are installed and licensed separately, consistent with other XBOX samples. There is no specified update cadence. We will watch the repo, monitor issues, and iterate where it makes sense. We are keen to hear your feedback and to see community PRs.

Windows-only, and pinned to one GDK edition. Everything here is built and verified against Microsoft GDK edition 260404. Building needs no GDK install at all; running against the Gaming Runtime needs the GDK, a dev-unlocked machine and a signed-in account. CI can only build, test and verify NativeAOT compilation - behaviour is validated by hand in a packaged title against a real sandbox.

Quick start

I want to... Start here
Add the projection to an existing .NET game Getting started
Clone, build and run the samples from source Building
See exactly what is projected, and what is not Projection status
Ship my .NET title on XBOX consoles Request access as a licensed XBOX developer
Draw the runtime's dialogs myself Title-implemented UI
Move to a newer GDK edition The pinned GDK edition
Browse the full documentation tree Documentation index

Building needs nothing but the .NET SDK:

dotnet restore
dotnet build -c Release
dotnet test -c Release --no-build

To run against the Gaming Runtime you need an installed GDK, a dev-unlocked machine and a signed-in XBOX account - but not a package:

pwsh eng/run-local.ps1 -Project Sample    # readable demo, self-contained, unpackaged
pwsh eng/run-local.ps1                    # the live harness, same
pwsh eng/run-package-tests.ps1            # the packaged path, which is what a title ships as

Overview

GDK.Net projects the GDK surface a .NET title actually needs, generated and verified against the real headers of edition 260404 rather than transcribed by hand:

  • Gaming Runtime - users and sign-in, game invites and protocol activation, storage, packages and DLC, game saves, game UI, networking, capture and broadcast, the Store, game streaming, accessibility, speech, and system metadata
  • XBOX Services - profile, achievements, social, presence, privacy, leaderboards, real-time activity, user and title-managed statistics, title storage, string verification, events, multiplayer activity, plus the social and achievements manager layers
  • PlayFab - Core and the full generated Services surface, Game Saves, Multiplayer (Lobby and Matchmaking), and Party including PartyXboxLive
  • NativeAOT - AOT-safe on net8.0 and net10.0, enforced by analyzers, warnings-as-errors and a real ILC compilation in CI

Coverage is measured, not asserted: 349 of 355 Gaming Runtime exports and 1,006 of 1,008 PlayFab exports are bound, the remainder being deliberately out of scope. Run eng/api-coverage.ps1 for the current tally, and see Projection status for what is excluded and why.

The projection ships no native code of its own. Every P/Invoke binds to redistributable modules the GDK already installs.

Modules

The core projection is one assembly. XBOX Services and PlayFab are separate native modules, so they are opt-in at packaging time - a title that does not use them does not carry them.

Opt-in property Native modules Managed surface
(always) xgameruntime.thunks.dll GDK.Net - the Gaming Runtime: GameRuntime, UserManager, GamePackage, GameSaveProvider, StoreContext, NetworkingManager, and the rest
<GdkNetIncludeXboxLive> Microsoft.Xbox.Services.C.Thunks.dll, libHttpClient.dll GameRuntime.XboxLive - profile, achievements, social, presence, privacy, leaderboards, stats, title storage, and the manager layers
<GdkNetIncludePlayFab> PlayFabCore.dll, PlayFabServices.dll, PlayFabGameSave.dll, libHttpClient.dll GDK.Net.PlayFab - PlayFabRuntime, the 20 generated service classes, PlayFabGameSaveFiles
<GdkNetIncludePlayFabMultiplayer> PlayFabMultiplayer.dll GDK.Net.PlayFab.Multiplayer - lobbies and matchmaking
<GdkNetIncludePlayFabParty> Party.dll, PartyXboxLive.dll GDK.Net.PlayFab.Party - voice, text chat and network transport

The last two PlayFab groups import PlayFabCore.dll, so asking for either turns <GdkNetIncludePlayFab> on as well. eng/packaging/GdkRedist.targets copies the modules you asked for next to the executable on every build.

Supported versions

Table A: Supported runtimes

Runtime / version Tier Architectures (RIDs) GDK edition Build toolchain Status
net8.0 LTS, Primary tier win-x64 (primary), win-arm64 260404 .NET SDK 10.0.x (verified locally: 10.0.302; 9.0.316 also present), MSVC v143+ / Windows SDK, ClangSharp for binding generation Supported
net10.0 LTS, Primary tier win-x64 (primary), win-arm64 260404 .NET SDK 10.0.x (verified locally: 10.0.302; 9.0.316 also present), MSVC v143+ / Windows SDK, ClangSharp for binding generation Supported
netstandard2.0 Compatibility tier (MonoGame / Mono / broad reach) win-x64 (primary), win-arm64 260404 .NET SDK 10.0.x (verified locally: 10.0.302; 9.0.316 also present), MSVC v143+ / Windows SDK, ClangSharp for binding generation Supported

Table B: Supported engines / frameworks

Engine / framework Version(s) Tier Status
MonoGame latest stable Windows project/template (policy: validate current stable release during pilot/live harness work) Release gate for game workflow integration Supported
Stride latest stable (policy: scheduled/nightly validation after the pilot locks conventions) Secondary engine workflow integration Supported
Bespoke hosts and tooling Microsoft-supported .NET LTS hosts on Windows Primary tools/services workflow Supported

Support policy

Only Microsoft-supported .NET LTS releases are targeted; the window moves as LTS releases ship and go EOL. netstandard2.0 exists solely for MonoGame/Mono reach. This projection is Windows-only (no Linux/macOS), and the GDK edition is pinned at 260404.

Documentation

Full documentation lives in docs/.

Start here:

  • Documentation index - the full doc tree
  • Getting started - the idioms the projection uses, initialising GameRuntime, signing in a user
  • Building - prerequisites, build and test, running unpackaged, packaging, the generation tooling
  • Architecture - the two layers, the native modules, the three target frameworks, the AOT contract, threading
  • Projection status - what is projected, what is out of scope, and the current coverage numbers

Reference:

Additional Documentation

Support and contributing

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.

About

Write your XBOX game in C#, not in P/Invoke. The .NET projection of the Microsoft GDK: Gaming Runtime, XBOX Services and PlayFab as Tasks, events and exceptions. NativeAOT-ready on .NET 8, .NET 10 and netstandard2.0.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

4 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages