次の方法で共有


簡略化された GDKX ディレクトリ構造

注意

このトピックで説明するヘッダーとライブラリの新しい Microsoft Game Development Kit (GDK) レイアウトは、2025 年 10 月の GDK でリリースされる予定です。 この GDK のプレビュー ビルドに関心がある場合は、Microsoft アカウント マネージャーにお問い合わせください。

現在のバージョンの Microsoft Game Development Kit (GDK) では、レイアウトはコード共有を中心に最適化され、特定のプラットフォームに重点を置いています。 このレイアウトのビルド統合は、MSBuild カスタム プラットフォームで複雑さを隠すのに大きく依存していました。 新しいレイアウトでは、統合を簡素化し、ターゲット プラットフォームのリストを増やし、ストック MSBuild プラットフォームと Microsoft 以外のビルド システムの両方のサポートを強化することに重点を置きます。

古いヘッダーとライブラリのレイアウト

Microsoft GDK の既存のファイル レイアウトを次に示します。

251000\
    GRDK\
        ExtensionLibraries\
            Xbox.Services.API.C\
                ExtensionLibrary.props
                DesignTime\CommonConfiguration\Neutral\
                    Include\
                    Lib\
                    Redist\
            ...
        GameKit\
            Include\
            Lib\
                amd64\
    GXDK\
        gameKit\
            Include\
                XboxOne\
                Scarlett\
            Lib\
                amd64\
                    XboxOne\
                    Scarlett\
        ToolKit\
            Include\
                    XboxOne\
                    Scarlett\
            Lib\
                amd64\
                    XboxOne\
                    Scarlett\

Gaming.Desktop.x64Gaming.Xbox.Scarlett.x64Gaming.Xbox.XboxOne.x64 カスタム MSBuild プラットフォームは、このコンテンツをすべてさまざまな方法で結合する include/lib パスを構築するためのすべてのロジックを実装します。 CMake またはカスタム メイク ソリューションを使用した場合は、このロジックもそこに実装する必要がありました。 詳細な例については、2025 年 4 月バージョンの CMakeExample を参照してください。

古いレイアウトは、古いスタイルと新しいスタイルの両方をサポートするために、2025 年 10 月の GDK にも残っています。 新しいレイアウトと古いレイアウトの両方が既定でインストールされます。 GDK セットアップに、新しいレイアウトのみをインストールするオプションが含まれるようになりました。 今後の GDK では、古いレイアウトが削除され、ハード ドライブのフットプリントと全体的なダウンロード サイズが削減されます。 古いレイアウトを削除するための現在のターゲット日付は、2025 年 10 月の GDK がリリースされた時点から 1 年になります。

新しいヘッダーとライブラリのレイアウト

2025 年 10 月の GDK リリースでは、プラットフォームの統合を大幅に容易にし、時間の経過と共に追加のプラットフォームに対応できるようにするヘッダーとライブラリの代替レイアウトが提供されるようになりました。

251000\
    windows\
        bin\
            arm64
            x64\
        include\
        lib\
            arm64
            x64\
        redist

    xbox\
        bin\
           gen8\
           gen9\
           devpctools\
              gen8\
              gen9\
              x64\
           x64\
        build\
        include\
        lib\
        redist\
        source\

MSBuild カスタム プラットフォームでの新しいレイアウトの使用

既存の Gaming.*.x64 MSBuild プラットフォームでは、既定では古いレイアウトが使用されますが、GDKCrossPlatform プロパティを設定することで新しいレイアウトを選択できます。

<PropertyGroup Label="Globals">
...
  <GDKCrossPlatform>true</GDKCrossPlatform>
</PropertyGroup>

これにより、古いレイアウトで使用されていたさまざまな複雑なパスではなく、適切な include/lib パスがプロジェクトに追加されます。

この新しい簡略化された統合では、拡張ライブラリ メカニズムは使用されなくなりました。 すべてのコンテンツは、include/lib パスで既定でビルド時に使用できます。

その後、プロジェクトは、使用する追加のライブラリにリンクする必要があります。 古い GDK プロジェクト テンプレート上に構築されたプロジェクトには、次のようなステートメントが含まれている必要があります。

<AdditionalDependencies>uuid.lib;$(Console_Libs);%(XboxExtensionsDependencies);%(AdditionalDependencies)</AdditionalDependencies>

新しいレイアウトの場合、Console_Libs プロパティにはコアに必要なライブラリが一覧表示されます。

プラットフォーム Core libs
Gaming.*.x64 xgameruntime.lib d3d12.lib dxguid.lib dxgi.lib gameinput.lib
Gaming.Xbox.Scarlett.x64 xgameruntime.lib xgameplatform.lib d3d12_xs.lib xg_xs.lib pixevt.lib xmem.lib
Gaming.Xbox.XboxOne.x64 xgameruntime.lib xgameplatform.lib d3d12_x.lib xg_x.lib pixevt.lib xmem.lib

プロジェクトは、それぞれ 'オプトイン' であるため、使用する拡張機能ライブラリを AdditionalDependencies に追加する必要があります。

プラットフォーム Core libs
Xbox.LibHttpClient libHttpClient.lib
Xbox.XCurl.API XCurl.lib
Xbox.Game.Chat.2.Cpp.API GameChat2.lib
Xbox.Services.API.C (デバッグ) Appnotify.lib winhttp.lib crypt32.lib Microsoft.Xbox.Services.142.C.Debug.lib
Xbox.Services.API.C (リリース) Appnotify.lib winhttp.lib crypt32.lib Microsoft.Xbox.Services.142.C.lib
PlayFab.Party.Cpp Party.lib
PlayFab.PartyXboxLive.Cpp PartyXboxLive.lib
PlayFab.Services.C PlayFabCore.lib PlayFabGameSave.lib PlayFabServices.lib
PlayFab.Multiplayer.Cpp PlayFabMultiplayer.lib

プロジェクトでは、使用する追加の DLL をレイアウトにコピーする必要もあります。 これは、多くの DLL ライブラリ統合の一般的なカスタム ビルド手順を使用するか、vcxproj を編集するか、または ReferenceCopyLocalPaths 項目グループ リストを使用する props ファイルを追加することによって実行できます。 以下の MSBuild には、使用可能なすべての DLL が一覧表示されていますが、個々のプロジェクトで必要なのは、これらの一部のみです。

  <PropertyGroup>
    <GDKCrossPlatformPath Condition="'$(GDKCrossPlatformPath)'==''">$(GameDKCoreLatest)</GDKCrossPlatformPath>
    <GDKCrossPlatformPath Condition="'$(GDKCrossPlatformPath)'==''">$(GameDKXboxLatest)</GDKCrossPlatformPath>
  </PropertyGroup>

  <ItemGroup Condition="'$(Platform)'=='Gaming.Desktop.x64'">
    <ReferenceCopyLocalPaths Include="$(GDKCrossPlatformPath)windows\bin\x64\libHttpClient.dll" />
    <ReferenceCopyLocalPaths Include="$(GDKCrossPlatformPath)windows\bin\x64\XCurl.dll" />
    <ReferenceCopyLocalPaths Include="$(GDKCrossPlatformPath)windows\bin\x64\GameChat2.dll" />
    <ReferenceCopyLocalPaths Include="$(GDKCrossPlatformPath)windows\bin\x64\Party.dll" />
    <ReferenceCopyLocalPaths Include="$(GDKCrossPlatformPath)windows\bin\x64\PartyXboxLive.dll" />
    <ReferenceCopyLocalPaths Include="$(GDKCrossPlatformPath)windows\bin\x64\PlayFabCore.dll" />
    <ReferenceCopyLocalPaths Include="$(GDKCrossPlatformPath)windows\bin\x64\PlayFabGameSave.dll" />
    <ReferenceCopyLocalPaths Include="$(GDKCrossPlatformPath)windows\bin\x64\PlayFabMultiplayer.dll" />
    <ReferenceCopyLocalPaths Include="$(GDKCrossPlatformPath)windows\bin\x64\PlayFabServices.dll" />
  </ItemGroup>

  <ItemGroup Condition="'$(Platform)'=='Gaming.Xbox.Scarlett.x64'">
    <ReferenceCopyLocalPaths Include="$(GDKCrossPlatformPath)xbox\bin\x64\libHttpClient.dll" />
    <ReferenceCopyLocalPaths Include="$(GDKCrossPlatformPath)xbox\bin\x64\XCurl.dll" />
    <ReferenceCopyLocalPaths Include="$(GDKCrossPlatformPath)xbox\bin\x64\GameChat2.dll" />
    <ReferenceCopyLocalPaths Include="$(GDKCrossPlatformPath)xbox\bin\x64\Party.dll" />
    <ReferenceCopyLocalPaths Include="$(GDKCrossPlatformPath)xbox\bin\x64\PartyXboxLive.dll" />
    <ReferenceCopyLocalPaths Include="$(GDKCrossPlatformPath)xbox\bin\x64\PlayFabCore.dll" />
    <ReferenceCopyLocalPaths Include="$(GDKCrossPlatformPath)xbox\bin\x64\PlayFabGameSave.dll" />
    <ReferenceCopyLocalPaths Include="$(GDKCrossPlatformPath)xbox\bin\x64\PlayFabMultiplayer.dll" />
    <ReferenceCopyLocalPaths Include="$(GDKCrossPlatformPath)xbox\bin\x64\PlayFabServices.dll" />
  </ItemGroup>

  <ItemGroup Condition="'$(Platform)'=='Gaming.Xbox.XboxOne.x64'">
    <ReferenceCopyLocalPaths Include="$(GDKCrossPlatformPath)xbox\bin\x64\libHttpClient.dll" />
    <ReferenceCopyLocalPaths Include="$(GDKCrossPlatformPath)xbox\bin\x64\XCurl.dll" />
    <ReferenceCopyLocalPaths Include="$(GDKCrossPlatformPath)xbox\bin\x64\GameChat2.dll" />
    <ReferenceCopyLocalPaths Include="$(GDKCrossPlatformPath)xbox\bin\x64\Party.dll" />
    <ReferenceCopyLocalPaths Include="$(GDKCrossPlatformPath)xbox\bin\x64\PartyXboxLive.dll" />
    <ReferenceCopyLocalPaths Include="$(GDKCrossPlatformPath)xbox\bin\x64\PlayFabCore.dll" />
    <ReferenceCopyLocalPaths Include="$(GDKCrossPlatformPath)xbox\bin\x64\PlayFabGameSave.dll" />
    <ReferenceCopyLocalPaths Include="$(GDKCrossPlatformPath)xbox\bin\x64\PlayFabMultiplayer.dll" />
    <ReferenceCopyLocalPaths Include="$(GDKCrossPlatformPath)xbox\bin\x64\PlayFabServices.dll" />
  </ItemGroup>

注意

GameDKLatest は、Xbox 拡張機能を使用した Microsoft GDK によってのみ設定されます。 その結果、Microsoft GDK の両方のバージョンのサイド バイ サイド インストールを完全にサポートする新しい環境変数が導入されました。GameDKCoreLatest は Microsoft GDK によって設定されます。 GameDKXboxLatest は、Xbox 拡張機能を使用して Microsoft GDK によって設定されます。

Directory.Build.props の使用

新しいレイアウトを使用して既存の GDK Gaming.*.x64 プロジェクトをすばやく検証する方法として、次のコンテンツをソース ツリーの Directory.Build.props という名前のファイルに配置します。 これにより、新しいレイアウトが選択され、プロジェクトで使用されていない場合でも、ほとんどの拡張機能ライブラリまたはすべての拡張ライブラリが含まれます。

注意

GDKCrossPlatform を true に設定してビルドする場合、GDKExtLibNames プロパティは MSBuild 規則では使用されません。 これは以前の MSBuild 規則を使用してビルドする場合に既に存在するため、レイアウト内の追加の DLL を選択する方法としてこの props ファイルで使用されます。

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

  <PropertyGroup>
    <GDKCrossPlatform>true</GDKCrossPlatform>
    <GDKCrossPlatformPath Condition="'$(GDKCrossPlatformPath)'==''">$(GameDKCoreLatest)</GDKCrossPlatformPath>
    <GDKCrossPlatformPath Condition="'$(GDKCrossPlatformPath)'==''">$(GameDKXboxLatest)</GDKCrossPlatformPath>
    <AllExtensionLibs>Appnotify.lib;winhttp.lib;crypt32.lib;libHttpClient.lib;XCurl.lib;GameChat2.lib;PlayFabCore.lib;PlayFabServices.lib;PlayFabMultiplayer.lib;Party.lib;PartyXboxLive.lib;PlayFabGameSave.lib</AllExtensionLibs>
    <AllExtensionLibs Condition="'$(Configuration)'=='Debug'">Microsoft.Xbox.Services.142.C.Debug.lib;$(AllExtensionLibs)</AllExtensionLibs>
    <AllExtensionLibs Condition="'$(Configuration)'!='Debug'">Microsoft.Xbox.Services.142.C.lib;$(AllExtensionLibs)</AllExtensionLibs>
  </PropertyGroup>

  <ItemDefinitionGroup Condition="'$(Platform)'=='Gaming.Desktop.x64'">
    <Link>
      <AdditionalDependencies>$(AllExtensionLibs);%(AdditionalDependencies)</AdditionalDependencies>
    </Link>
  </ItemDefinitionGroup>

  <!--
    We use XboxExtensionsDependencies because of a hack in our Gaming.Xbox.*.x64 platforms which forces
    AdditionalDependencies to xgameplatform.lib, but means we can't use AdditionalDependencies this early.
  -->

  <ItemDefinitionGroup Condition="'$(Platform)'=='Gaming.Xbox.Scarlett.x64' OR '$(Platform)'=='Gaming.Xbox.XboxOne.x64'">
    <Link>
      <XboxExtensionsDependencies>$(AllExtensionLibs);%(XboxExtensionsDependencies)</XboxExtensionsDependencies>
    </Link>
  </ItemDefinitionGroup>

  <!--
    Makes sure we deploy all the libs we need. We use the 'old layout' GDKExtLibNames property as a way to test
    what is requested to try to reduce the over-inclusion of unused DLLs.
  -->

  <ItemGroup Condition="'$(Platform)'=='Gaming.Desktop.x64'">
    <ReferenceCopyLocalPaths Include="$(GDKCrossPlatformPath)windows\bin\x64\libHttpClient.dll" />
    <ReferenceCopyLocalPaths Include="$(GDKCrossPlatformPath)windows\bin\x64\XCurl.dll" />
  </ItemGroup>

  <ItemGroup Condition="'$(Platform)'=='Gaming.Desktop.x64' AND $(GDKExtLibNames.Contains('Xbox.Game.Chat.2.Cpp.API'))">
    <ReferenceCopyLocalPaths Include="$(GDKCrossPlatformPath)windows\bin\x64\GameChat2.dll" />
  </ItemGroup>

  <ItemGroup Condition="'$(Platform)'=='Gaming.Desktop.x64' AND $(GDKExtLibNames.Contains('PlayFab'))">
    <ReferenceCopyLocalPaths Include="$(GDKCrossPlatformPath)windows\bin\x64\Party.dll" />
    <ReferenceCopyLocalPaths Include="$(GDKCrossPlatformPath)windows\bin\x64\PartyXboxLive.dll" />
    <ReferenceCopyLocalPaths Include="$(GDKCrossPlatformPath)windows\bin\x64\PlayFabCore.dll" />
    <ReferenceCopyLocalPaths Include="$(GDKCrossPlatformPath)windows\bin\x64\PlayFabGameSave.dll" />
    <ReferenceCopyLocalPaths Include="$(GDKCrossPlatformPath)windows\bin\x64\PlayFabMultiplayer.dll" />
    <ReferenceCopyLocalPaths Include="$(GDKCrossPlatformPath)windows\bin\x64\PlayFabServices.dll" />
  </ItemGroup>

  <ItemGroup Condition="'$(Platform)'=='Gaming.Xbox.Scarlett.x64' OR '$(Platform)'=='Gaming.Xbox.XboxOne.x64'">
    <ReferenceCopyLocalPaths Include="$(GDKCrossPlatformPath)xbox\bin\x64\libHttpClient.dll" />
    <ReferenceCopyLocalPaths Include="$(GDKCrossPlatformPath)xbox\bin\x64\XCurl.dll" />
  </ItemGroup>

  <ItemGroup Condition="('$(Platform)'=='Gaming.Xbox.Scarlett.x64' OR '$(Platform)'=='Gaming.Xbox.XboxOne.x64') AND $(GDKExtLibNames.Contains('Xbox.Game.Chat.2.Cpp.API'))">
    <ReferenceCopyLocalPaths Include="$(GDKCrossPlatformPath)xbox\bin\x64\GameChat2.dll" />
  </ItemGroup>

  <ItemGroup Condition="('$(Platform)'=='Gaming.Xbox.Scarlett.x64' OR '$(Platform)'=='Gaming.Xbox.XboxOne.x64') AND $(GDKExtLibNames.Contains('PlayFab'))">
    <ReferenceCopyLocalPaths Include="$(GDKCrossPlatformPath)xbox\bin\x64\Party.dll" />
    <ReferenceCopyLocalPaths Include="$(GDKCrossPlatformPath)xbox\bin\x64\PartyXboxLive.dll" />
    <ReferenceCopyLocalPaths Include="$(GDKCrossPlatformPath)xbox\bin\x64\PlayFabCore.dll" />
    <ReferenceCopyLocalPaths Include="$(GDKCrossPlatformPath)xbox\bin\x64\PlayFabGameSave.dll" />
    <ReferenceCopyLocalPaths Include="$(GDKCrossPlatformPath)xbox\bin\x64\PlayFabMultiplayer.dll" />
    <ReferenceCopyLocalPaths Include="$(GDKCrossPlatformPath)xbox\bin\x64\PlayFabServices.dll" />
  </ItemGroup>

</Project>

MSBuild x64 プラットフォームでの新しいレイアウトの使用

Gaming.Desktop.x64 プラットフォームを使用する代わりに、ストック x64 プラットフォームを使用して PC 用にビルドできます。 以前のレイアウトでは、「Microsoft Game Development Kit (GDK) で x64 プラットフォームを使用する」で詳しく説明されているように、拡張機能ライブラリの<Import Project="...\ExtensionLibrary.props">ステートメントを追加する必要がありました。

新しいレイアウトでは、統合手順が効率化されます。

  <PropertyGroup>
    <GDKCrossPlatformPath Condition="'$(GDKCrossPlatformPath)'==''">$(GameDKCoreLatest)</GDKCrossPlatformPath>
    <GDKCrossPlatformPath Condition="'$(GDKCrossPlatformPath)'==''">$(GameDKXboxLatest)</GDKCrossPlatformPath>
  </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
  <ExecutablePath>$(GameDK)bin;$(GDKCrossPlatformPath)windows\bin\x64;$(ExecutablePath)</ExecutablePath>
  <IncludePath>$(GDKCrossPlatformPath)windows\Include;$(IncludePath);</IncludePath>
  <LibraryPath>$(GDKCrossPlatformPath)windows\lib\x64;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
  <ExecutablePath>$(GameDK)bin;$(GDKCrossPlatformPath)windows\bin\x64;$(ExecutablePath)</ExecutablePath>
  <IncludePath>$(GDKCrossPlatformPath)windows\Include;$(IncludePath);</IncludePath>
  <LibraryPath>$(GDKCrossPlatformPath)windows\lib\x64;$(LibraryPath)</LibraryPath>
</PropertyGroup>

必要なすべての拡張機能ライブラリを、元のリストと共に AdditionalDependencies に追加します。

<AdditionalDependencies>xgameruntime.lib;gameinput.lib;d3d12.lib;dxgi.lib;dxguid.lib;uuid.lib;kernel32.lib;user32.lib;%(AdditionalDependencies)</AdditionalDependencies>

オプトイン拡張機能ライブラリ DLL は、カスタム ビルド アクションを使用するか、最終的なレイアウトに ReferenceCopyLocalPaths 項目グループを使用して、上記のようにバイナリ ディレクトリにコピーする必要があります。

PreprocessorDefinitions とイメージ資産を使用した .mgc ファイルの処理に関する残りの手順は変更されません。

CMake での新しいレイアウトの使用

CMake で Microsoft Visual Studio ジェネレーターを使用し、Gaming.*.x64 カスタム MSBuild プラットフォームを使用する場合、新しいレイアウトは次のように有効になります。

set_property(TARGET ${PROJECT_NAME} PROPERTY VS_GLOBAL_GDKCrossPlatform "true")

CMakeGDKExample で、VS_GLOBAL_GDKExtLibNames の使用を削除し、次の (CMake 3.21 以降を想定) に置き換えて、使用されている拡張機能 DLL をレイアウトにコピーします。

add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
    COMMAND ${CMAKE_COMMAND} -E $<IF:$<BOOL:$<TARGET_RUNTIME_DLLS:${PROJECT_NAME}>>,copy,true>
    $<TARGET_RUNTIME_DLLS:${PROJECT_NAME}> $<TARGET_FILE_DIR:${PROJECT_NAME}>
    COMMAND_EXPAND_LISTS
    )

カスタム ビルド システムでの新しいレイアウトの使用

GDK を使用して Windows x64 をビルドするには、次のものが必要です。

set INCLUDE=%GameDKXboxLatest%windows\include;%INCLUDE%
set LIB=%GameDKXboxLatest%windows\lib\x64;%LIB%
set PATH=%GameDK%bin;%GameDKXboxLatest%windows\bin\x64;%PATH%

Xbox Series X|S 用のビルド (Gaming.Xbox.Scarlett.x64) には、次のものが必要です:

set INCLUDE=%GameDKXboxLatest%xbox\include\gen9;%GameDKXboxLatest%xbox\include;%INCLUDE%
set LIB=%GameDKXboxLatest%xbox\lib\gen9;%GameDKXboxLatest%xbox\lib\x64;%LIB%
set PATH=%GameDK%bin;%GameDKXboxLatest%xbox\bin\gen9;%GameDKXboxLatest%xbox\bin\x64;%PATH%

Xbox One 用のビルド (Gaming.Xbox.XboxOne.x64) には、次のものが必要です:

set INCLUDE=%GameDKXboxLatest%xbox\include\gen8;%GameDKXboxLatest%xbox\include;%INCLUDE%
set LIB=%GameDKXboxLatest%xbox\lib\gen8;%GameDKXboxLatest%xbox\lib\x64;%LIB%
set PATH=%GameDK%bin;%GameDKXboxLatest%xbox\bin\gen8;%GameDKXboxLatest%xbox\bin\x64;%PATH%

PC コンテンツ ツールの新しいレイアウトの使用

コンソール開発では、XTF API、XMA2 エンコード ライブラリ、カスタム Direct3D 12.X ツールを使用して、開発用 PC で一部の種類のコンテンツ "クッキング" が行われます。 このコンテンツにアクセスするには、特定のビルド設定が必要です:

Xbox One とXbox Series X|S の両方を対象とする PC ツールをビルドするには、次のものが必要です:

set INCLUDE=%GameDKXboxLatest%xbox\include\devpctools;%GameDK%\toolKit\include;%INCLUDE%
set LIB=%GameDKXboxLatest%xbox\lib\devpctools\x64;%GameDK%\toolKit\lib\amd64;%LIB%
set PATH=%GameDK%bin;%PATH%

Xbox Series X|S グラフィックスを対象とする PC ツールをビルドするには、次のものが必要です:

set INCLUDE=%GameDKXboxLatest%xbox\include\devpctools\gen9;%GameDKXboxLatest%xbox\include\devpctools;%GameDK%\toolKit\include;%INCLUDE%
set LIB=%GameDKXboxLatest%xbox\lib\devpctools\gen9;%GameDKXboxLatest%xbox\lib\devpctools\x64;%GameDK%\toolKit\lib\amd64;%LIB%
set PATH=%GameDKXboxLatest%xbox\devpctools\bin\gen9;%GameDK%bin;%PATH%

Xbox One グラフィックスを対象とする PC ツールをビルドするには、次のものが必要です:

set INCLUDE=%GameDKXboxLatest%xbox\include\devpctools\gen8;%GameDKXboxLatest%xbox\include\devpctools;%GameDK%\toolKit\include;%INCLUDE%
set LIB=%GameDKXboxLatest%xbox\lib\devpctools\gen8;%GameDKXboxLatest%xbox\lib\devpctools\x64;%GameDK%\toolKit\lib\amd64;%LIB%
set PATH=%GameDKXboxLatest%xbox\devpctools\bin\gen8;%GameDK%bin;%PATH%

インストールされているファイルからのビルド エディションの読み取り

新しいレイアウトには、grdk.ini または gxdk.ini ファイルは含まれません。 ファイルを解析してエディション情報を見つけるには、grdk.h または gxdk.h を使用します。

古い GDK リリースでも動作する PowerShell の例を次に示します。

$result = Get-ChildItem -Path $env:GameDKXboxLatest -Filter "gxdk.h" -Recurse
if ($result.Count -eq 0)
{
    $result = Get-ChildItem -Path $env:GXDKLatest -Filter "gxdk.h" -Recurse
}
if ($result.Count -eq 0)
{
    Write-Error "##[error]Failed to find gxdk.h in either GameDKXboxLatest or GXDKLatest" -ErrorAction Stop
}

$content = Get-Content -Path $result[0].FullName

if (-not ([string]$content -match '#define\s+_GXDK_EDITION\s+([0-9][0-9][0-9][0-9][0-9][0-9])')) {
    Write-Error "##[error]Failed to find edition define" -ErrorAction Stop
}

$xbld_edition = $Matches[1]

if (-not ([string]$content -match '#define\s+_GXDKVER_PRODUCTBUILDVER_FULL\s+([0-9]+\.[0-9]+\.([0-9]+)\.[0-9]+)')) {
    Write-Error "##[error]Failed to find full version define" -ErrorAction Stop
}

$xbld_full_productbuild = $Matches[1]
$xbld_build = $Matches[2]

if (-not ([string]$content -match '#define\s+_GXDK_MM_NUM\s+([0-9]{1,2})')) {
    Write-Error "##[error]Failed to find month define" -ErrorAction Stop
}

$month = $Matches[1]

if (-not ([string]$content -match '#define\s+_GXDK_FULLYY\s+([0-9]{4})')) {
    Write-Error "##[error]Failed to find full year define" -ErrorAction Stop
}

$year = $Matches[1]

Write-Output ("_xbld_name={0} {1} GXDK" -f (Get-Culture).DateTimeFormat.GetMonthName([int]$month), $year)
Write-Output ("_xbld_edition={0}" -f $xbld_edition)
Write-Output ("_xbld_full_productbuild={0}" -f $xbld_full_productbuild)
Write-Output ("_xbld_build={0}" -f $xbld_build)

インストールせずにビルドする (BWOI)

以前のレイアウトの <edition>\flatDeployment の下にもともと配置されていた MSBuild カスタム ビルド プラットフォーム ファイルが、パスが短縮された <edition>\xbox\build の下に配置されるようになりました。

たとえば、VS 2022 の BWOI MSBuild ルール フォルダーを設定するには、次のコマンドを使用します。

rd /q /s c:\temp\msbuildgdk
md c:\temp\msbuildgdk
xcopy "%VSInstallDir%\MSBuild\Microsoft\VC" /s c:\temp\msbuildgdk
xcopy "%GameDKXboxLatest%\xbox\build\VS2022\gen8" c:\temp\msbuildgdk /s
xcopy "%GameDKXboxLatest%\xbox\build\VS2022\gen9" c:\temp\msbuildgdk /s
xcopy "%GameDKXboxLatest%\xbox\build\VS2022\pc" c:\temp\msbuildgdk /s

次に、BWOI に使用される Directory.Build.props で、この結合フォルダーを指すようにプロパティを設定します。

<PropertyGroup Condition="'$([System.Text.RegularExpressions.Regex]::IsMatch('$(Platform)', 'Gaming\..+\.x64'))">
   <VCTargetsPath17>c:\temp\msbuildgdk\v170\</VCTargetsPath17>
   <VCTargetsPath16>c:\temp\msbuildgdk\v160\</VCTargetsPath16>
</PropertyGroup>