> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 不安裝 GDK 即設定 GDK 專案

> 說明在不安裝 Microsoft Game Development Kit 的情況下設定專案的程序。

# 在不安裝 Microsoft Game Development Kit 的情況下設定專案

本主題說明如何設定專案，以便在參考已解壓縮之 Microsoft Game Development Kit (GDK) 檔案的同時使用 MSBuild 進行建置。若要下載使用 MSBuild 和 CMake 的範例專案，請參閱[專案設定範例](#bwoi-samples)一節。

| 章節 | 涵蓋內容 |
| - | - |
| [平台屬性與目標檔案](#bwoi-platformsandtargets) | 屬於 GDK 一部分的屬性與目標檔案之類型和位置 |
| [覆寫 MSBuild 屬性](#bwoi-overridingproperties) | 如何覆寫屬性以搭配平面部署的 GDK 運作 |
| [Gaming.Xbox.XboxOne.x64 和 Gaming.Xbox.Scarlett.x64 專案自訂](#bwoi-xboxprojects) | 設定 XBOX 專案以搭配平面部署的 GDK 運作的步驟 |
| [GDK 的 Gaming.Xbox.XboxOne.x64 和 Gaming.Xbox.Scarlett.x64 屬性覆寫](#bwoi-xboxgdkoverrides) | 搭配平面部署的 GDK 運作的 XBOX 屬性覆寫 |
| [Windows 10 SDK 的 Gaming.Xbox.XboxOne.x64 和 Gaming.Xbox.Scarlett.x64 屬性覆寫](#bwoi-xboxsdkoverrides) | 搭配平面部署的 Windows 10 SDK 運作的 XBOX 屬性覆寫 |
| [Gaming.Xbox.XboxOne.x64 程式庫與 include 參考](#bwoi-xboxonereferences) | XBOX One 專案的程式庫與 include 參考路徑 |
| [Gaming.Xbox.Scarlett.x64 程式庫與 include 參考](#bwoi-scarlettreferences) | XBOX Series X\|S 專案的程式庫與 include 參考路徑 |
| [Gaming.Xbox.XboxOne.x64 和 Gaming.Xbox.Scarlett.x64 延伸程式庫](#bwoi-xboxextensions) | 延伸程式庫 (例如 Xbox.Game.Chat) 的 XBOX 屬性檔案 |
| [Gaming.Desktop.x64 專案自訂](#bwoi-desktopprojects) | 設定 PC 桌面專案以搭配平面部署的 GDK 運作的步驟 |
| [GDK 的 Gaming.Desktop.x64 屬性覆寫](#bwoi-desktopgdkoverrides) | 搭配平面部署的 GDK 運作的 PC 桌面屬性覆寫 |
| [Windows 10 SDK 的 Gaming.Desktop.x64 屬性覆寫](#bwoi-desktopsdkoverrides) | 搭配平面部署的 Windows 10 SDK 運作的 PC 桌面屬性覆寫 |
| [Gaming.Desktop.x64 程式庫與 include 參考](#bwoi-desktopreferences) | PC 桌面專案的程式庫與 include 參考路徑 |
| [Gaming.Desktop.x64 延伸程式庫](#bwoi-desktopextensions) | 延伸程式庫 (例如 Xbox.Game.Chat) 的 PC 桌面屬性檔案 |
| [PC 端工具的屬性設定](#bwoi-pctools) | 正確使用 PC 端工具所需的屬性覆寫 |
| [Visual Studio 版本特定的覆寫](#bwoi-vsoverrides) | 各 Visual Studio 版本所需的屬性覆寫 |
| [Visual Studio 2019 平台覆寫](#bwoi-vs2019overrides) | Visual Studio 2019 中 *Platform* 資料夾位置的屬性覆寫 |
| [Visual Studio 2022 平台覆寫](#bwoi-vs2022overrides) | Visual Studio 2022 中 *Platform* 資料夾位置的屬性覆寫 |
| [專案設定範例](#bwoi-samples) | 快速開始使用平面部署 GDK 的範例 |
| [CMake 範例](#bwoi-cmakesample) | 將專案與平面部署的 GDK 整合的 CMake 範例 |
| [MSBuild 範例](#bwoi-msbuildsample) | 將專案與平面部署的 GDK 整合的 MSBuild 範例 |

<a id="bwoi-platformsandtargets" />

## 平台屬性與目標檔案

GDK 解壓縮的檔案中包含一組屬性與目標檔案，用於建置 Gaming.Xbox.XboxOne.x64、Gaming.Xbox.Scarlett.x64 或 Gaming.Desktop.x64 平台。在定義我們的平台進行建置時，這些平台會從 *Microsoft.Cpp.Default.props* 查閱中匯入。檢查這些檔案有助於您進一步了解平台 MSBuild 元件的運作方式，以及如何以最佳方式將其整合到您的建置系統中。

根據 Visual Studio 版本、Platform Toolset 版本和平台目標，這些檔案共有十六個執行個體。已解壓縮之 *GDK* 資料夾中的範例路徑如下。

* *C:\ExtractedGDK\241000\Microsoft GDK\241000\GXDK\VS2019\flatDeployment\MSBuild\Microsoft\VC\v160\Platforms\Gaming.Xbox.XboxOne.x64*
* *C:\ExtractedGDK\241000\Microsoft GDK\241000\GXDK\VS2019\flatDeployment\MSBuild\Microsoft\VC\v160\Platforms\Gaming.Xbox.Scarlett.x64*
* *C:\ExtractedGDK\241000\Microsoft GDK\241000\GXDK\VS2022\flatDeployment\MSBuild\Microsoft\VC\v160\Platforms\Gaming.Xbox.XboxOne.x64*
* *C:\ExtractedGDK\241000\Microsoft GDK\241000\GXDK\VS2022\flatDeployment\MSBuild\Microsoft\VC\v160\Platforms\Gaming.Xbox.Scarlett.x64*
* *C:\ExtractedGDK\241000\Microsoft GDK\241000\GXDK\VS2022\flatDeployment\MSBuild\Microsoft\VC\v170\Platforms\Gaming.Xbox.XboxOne.x64*
* *C:\ExtractedGDK\241000\Microsoft GDK\241000\GXDK\VS2022\flatDeployment\MSBuild\Microsoft\VC\v170\Platforms\Gaming.Xbox.Scarlett.x64*
* *C:\ExtractedGDK\241000\Microsoft GDK\241000\GRDK\VS2019\flatDeployment\MSBuild\Microsoft\VC\v160\Platforms\gaming.desktop.x64*
* *C:\ExtractedGDK\241000\Microsoft GDK\241000\GRDK\VS2022\flatDeployment\MSBuild\Microsoft\VC\v160\Platforms\gaming.desktop.x64*
* *C:\ExtractedGDK\241000\Microsoft GDK\241000\GRDK\VS2022\flatDeployment\MSBuild\Microsoft\VC\v170\Platforms\gaming.desktop.x64*

Visual Studio 2019 和 Visual Studio 2022 的 v160 與 v170 資料夾之間的差異，在於使用 v142 (v160) 或 v143 (v170) Platform Toolset 版本 (定義於 \$(PlatformToolset) 屬性中)。

<Note>
  對於 GDK 新版面配置，這些檔案位於 `C:\ExtractedGDK\251000\Microsoft GDK\251000\xbox\build`，路徑已縮短。下方列出的 INCLUDE/LIB 路徑也假設您使用的是舊版面配置，而不是新的簡化整合。
</Note>

[返回本主題頂端。](#)

<a id="bwoi-overridingproperties" />

## 覆寫 MSBuild 屬性

有多種方式可以覆寫專案中的 MSBuild 屬性。其中一種便利的方法是在專案檔所在的相同目錄中建立 [Directory.Build.props](https://learn.microsoft.com/visualstudio/msbuild/customize-your-build#directorybuildprops-and-directorybuildtargets) 檔案。建置專案時，會自動套用此檔案中定義的屬性。如果檔案不存在，就不會套用覆寫。這表示無論是否已安裝 Microsoft Game Development Kit (GDK)，您都可以使用相同的專案檔。如果已安裝 Microsoft Game Development Kit (GDK)，請移除或重新命名 Directory.Build.props，以使用一般建置程序。

[MSBuild 範例](#bwoi-msbuildsample)示範如何使用 Directory.Build.props 檔案。

下列各節說明我們建議您覆寫哪些屬性以指向已解壓縮的 Microsoft Game Development Kit (GDK)，以及可在何處找到有關 lib 和 include 路徑的更多詳細資料。

[返回本主題頂端。](#)

<a id="bwoi-xboxprojects" />

## Gaming.Xbox.XboxOne.x64 和 Gaming.Xbox.Scarlett.x64 專案自訂

若要從已解壓縮的 GDK 使用 MSBuild 建置 Gaming.Xbox.XboxOne.x64 和 Gaming.Xbox.Scarlett.x64 專案，必須進行專案自訂。就需要覆寫的屬性而言，Gaming.Xbox.XboxOne.x64 與 Gaming.Xbox.Scarlett.x64 之間最重要的差異是 `Platform` 屬性定義。

<a id="bwoi-xboxgdkoverrides" />

### GDK 的 Gaming.Xbox.XboxOne.x64 和 Gaming.Xbox.Scarlett.x64 屬性覆寫

必須設定下列屬性，才能成功建置針對 Gaming.Xbox.XboxOne.x64 和 Gaming.Xbox.Scarlett.x64 平台設定的專案。這些屬性應在匯入專案檔中定義的 *Microsoft.Cpp.Default.props* 之前匯入。

#### 所覆寫屬性的說明

* `BWOI_GDK_Path:` 非必要的使用者屬性，但我們建議您設定此屬性，以便在後續屬性值中使用，減少硬式編碼的路徑。
* `Platform`：指定用來編譯專案的平台。GDK 中的 XBOX 主機系列選項為 Gaming.Xbox.XboxOne.x64 和 Gaming.Xbox.Scarlett.x64。此屬性會在新專案範本中設定。
* `XdkEditionTarget`：覆寫用於建置編譯的 GDK 版本。它定義於 *Platform.default.props* 中，並衍生自 `XdkEdition` (在 *xdk.props* 中設定的內部屬性)。
* `DurangoXdkInstallPath`：覆寫已解壓縮之 GDK 的 *Microsoft Game Development Kit (GDK)* 資料夾位置。它定義於 *Platform.Edition.default.props* 中。
* `DefaultXdkEditionRootVS2019`：覆寫與 Visual Studio 2019 相容之 `Platform` 屬性與目標檔案的預設位置。它定義於 *Platform.default.props* 中。只有在搭配 Visual Studio 2019 使用專案時，才應定義此屬性。
* `XdkEditionRootVS2019`：覆寫與 Visual Studio 2019 相容之 `Platform` 屬性與目標檔案的位置。它定義於 *Platform.props* 中。只有在搭配 Visual Studio 2019 使用專案時，才應定義此屬性。
* `DefaultXdkEditionRootVS2022`：覆寫與 Visual Studio 2022 相容之 `Platform` 屬性與目標檔案的預設位置。它定義於 *Platform.default.props* 中。只有在搭配 Visual Studio 2022 使用專案時，才應定義此屬性。
* `XdkEditionRootVS2022`：覆寫與 Visual Studio 2022 相容之 `Platform` 屬性與目標檔案的位置。它定義於 *Platform.props* 中。只有在搭配 Visual Studio 2022 使用專案時，才應定義此屬性。
* `PlatformToolset`：覆寫用於建置之建置工具的特定版本。Visual Studio 2019 支援 v142。Visual Studio 2022 支援 v142 和 v143 (預設定義為 v143)。此屬性定義於 *Microsoft.Cpp.Defaults.props* 中。

以下是根據先前已解壓縮資料夾範例的 Gaming.Xbox.Scarlett.x64 屬性值範例，供您參考：

```xml theme={null}
<BWOI_GDK_Path>C:\ExtractedGDK\241000\</BWOI_GDK_Path>
<Platform>Gaming.Xbox.Scarlett.x64</Platform>
<XdkEditionTarget>241000</XdkEditionTarget>
<DurangoXdkInstallPath>$(BWOI_GDK_Path)Microsoft GDK\</DurangoXdkInstallPath>
<DefaultXdkEditionRootVS2019>$(XdkEditionTarget)\GXDK\VS2019\flatDeployment\MSBuild\Microsoft\VC\v160\Platforms\$(Platform)\</DefaultXdkEditionRootVS2019>
<XdkEditionRootVS2019>$(DurangoXdkInstallPath)$(XdkEditionTarget)\GXDK\VS2019\flatDeployment\MSBuild\Microsoft\VC\v160\Platforms\$(Platform)\</XdkEditionRootVS2019>
<DefaultXdkEditionRootVS2022>$(XdkEditionTarget)\GXDK\VS2022\flatDeployment\MSBuild\Microsoft\VC\v170\Platforms\$(Platform)\</DefaultXdkEditionRootVS2022>
<XdkEditionRootVS2022>$(DurangoXdkInstallPath)$(XdkEditionTarget)\GXDK\VS2022\flatDeployment\MSBuild\Microsoft\VC\v170\Platforms\$(Platform)\</XdkEditionRootVS2022>
<PlatformToolset>$(PlatformToolset)</PlatformToolset>
```

若要覆寫 *Platform* 資料夾以偵測 Gaming.Xbox.XboxOne.x64 特定和 Gaming.Xbox.Scarlett.x64 特定的 .props 和目標，請參閱下一節有關 Visual Studio 平台覆寫的說明。

[返回本主題頂端。](#)

<a id="bwoi-xboxsdkoverrides" />

### Windows 10 SDK 的 Gaming.Xbox.XboxOne.x64 和 Gaming.Xbox.Scarlett.x64 屬性覆寫

只有在使用已解壓縮的 Windows 10 SDK 時，才需要設定下列屬性。如果您使用的是已安裝的 Windows 10 SDK，可以略過本節。

* `BWOI_Win10SDK_Path`：非必要的使用者屬性，但我們建議您設定此屬性，以便在後續屬性值中使用，減少硬式編碼的路徑。
* `WindowsSdkDir`：覆寫 Windows 10 SDK 的位置。
* `WindowsSdkDir_10:` 覆寫 Windows 10 SDK (Windows 10) 的位置。此屬性會透過 *Microsoft.Cpp.WindowsSDK.props* 中的登錄機碼進行檢查，該檔案會在建置編譯期間匯入。
* `UCRTContentRoot`：覆寫通用 C 執行階段程式庫內容根目錄的位置。此屬性定義於 *uCRT.props* 中。
* `UniversalCRTSdkDir`：覆寫通用 C 執行階段程式庫 SDK (Visual C++ C 執行階段) 的位置。此屬性會透過 *Microsoft.Cpp.WindowsSDK.props* 中的登錄機碼進行檢查，該檔案會在建置編譯期間匯入。
* `UniversalCRTSdkDir_10`：覆寫通用 C 執行階段程式庫 SDK (適用於 Windows 10 的 Visual C++ C 執行階段) 的位置。此屬性會透過 *Microsoft.Cpp.WindowsSDK.props* 中的登錄機碼進行檢查，該檔案會在建置編譯期間匯入。
* `WindowsSDK_ExecutablePath_x86`：覆寫 Windows 10 SDK 所包含之 x86 工具的位置。`rc.exe` 等工具位於此位置。此屬性定義於 *Microsoft.Cpp.WindowsSDK.props* 中。
* `WindowsSDK_ExecutablePath_x64`：覆寫 Windows 10 SDK 所包含之 x64 工具的位置。`rc.exe` 等工具位於此位置。此屬性定義於 *Microsoft.Cpp.WindowsSDK.props* 中。
* `WindowsTargetPlatformVersion`：覆寫所使用的 Windows 10 SDK 版本。此屬性定義於 *Platform.Edition.default.props* 檔案中 (若未定義，則會逐一檢查本機路徑)。
* `TargetPlatformVersion`：覆寫所使用的 Windows 10 SDK 版本。此屬性定義於 *Microsoft.Cpp.WindowsSDK.props* 中。

以下是根據先前已解壓縮資料夾範例的屬性值範例，供您參考：

```xml theme={null}
<BWOI_Win10SDK_Path>C:\ExtractedWin10SDK\</BWOI_Win10SDK_Path>
<WindowsSdkDir>$(BWOI_Win10SDK_Path)Windows Kits\10\</WindowsSdkDir>
<WindowsSdkDir_10>$(WindowsSdkDir)</WindowsSdkDir_10>
<UCRTContentRoot>$(WindowsSdkDir)</UCRTContentRoot>
<UniversalCRTSdkDir>$(WindowsSdkDir)</UniversalCRTSdkDir>
<UniversalCRTSdkDir_10>$(WindowsSdkDir)</UniversalCRTSdkDir_10>
<WindowsSDK_ExecutablePath_x86>$(WindowsSdkDir)bin\$(WindowsTargetPlatformVersion)\x86</WindowsSDK_ExecutablePath_x86>
<WindowsSDK_ExecutablePath_x64>$(WindowsSdkDir)bin\$(WindowsTargetPlatformVersion)\x64</WindowsSDK_ExecutablePath_x64>
<WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion>
<TargetPlatformVersion>$(WindowsTargetPlatformVersion)</TargetPlatformVersion>
```

> Microsoft GDK 需要 Windows 10 SDK (19041) 或更新版本。您可以視需要使用 Windows SDK (20348、22000 或 22621)，但這不是必要的。

> 自 2023 年 10 月版本起，需要 Windows 11 SDK (22000) 或更新版本。您可以視需要使用 Windows 11 SDK 22H2 版 (22621)，但這不是必要的。請將所有 "10.0.19041.0" 的執行個體取代為 "10.0.22000.0"。

[返回本主題頂端。](#)

<a id="bwoi-xboxonereferences" />

### Gaming.Xbox.XboxOne.x64 程式庫與 include 參考

程式庫與 include 參考\_不\_需要直接覆寫，因為它們衍生自先前提及的已覆寫路徑。本節僅供參考。

這些參考定義於 Gaming.Xbox.XboxOne.x64 *Platform* 資料夾內的 *Platform.Edition.props* 中。屬性的建構方式如下。

```xml theme={null}
<Console_LibRoot>$(WindowsSDKDir)Lib\$(TargetPlatformVersion)\</Console_LibRoot>
<Console_EndpointLibRoot>$(DurangoXdkInstallPath)GXDK\gameKit\Lib\amd64;$(DurangoXdkInstallPath)GXDK\gameKit\Lib\amd64\XboxOne;$(DurangoXdkInstallPath)GRDK\gameKit\Lib\amd64</Console_EndpointLibRoot>
<Console_EndpointIncludeRoot>$(DurangoXdkInstallPath)GXDK\gameKit\Include\;$(DurangoXdkInstallPath)GXDK\gameKit\Include\XboxOne\;$(DurangoXdkInstallPath)GRDK\gameKit\Include\</Console_EndpointIncludeRoot>
<Console_WindowsIncludeRoot>$(WindowsSDKDir)Include\$(TargetPlatformVersion)\</Console_WindowsIncludeRoot>
<Console_Libs Condition="'$(Console_Libs)'==''">pixevt.lib;d3d12_x.lib;xgameplatform.lib;xgameruntime.lib;xmem.lib;xg_x.lib</Console_Libs>
<Console_UCRTRedistDebug>$(WindowsSDKDir)bin\$(TargetPlatformVersion)\x64\ucrt\</Console_UCRTRedistDebug>
<Console_SdkRoot>$(DurangoXdkInstallRoot)</Console_SdkRoot>
<Console_SdkIncludeRoot>$(Console_EndpointIncludeRoot);$(WindowsSDK_IncludePath);$(UniversalCRT_IncludePath);$(VC_VC_IncludePath);</Console_SdkIncludeRoot>
<Console_SdkLibPath>$(Console_EndpointLibRoot);$(WindowsSDK_LibraryPath_x64);$(UniversalCRT_LibraryPath_x64);$(VC_LibraryPath_VC_x64_OneCore)</Console_SdkLibPath>
```

MSBuild 記錄中程式庫與 include 屬性的定義範例：

```bash theme={null}
Console_EndpointIncludeRoot = C:\ExtractedGDK\241000\Microsoft GDK\241000\GXDK\gameKit\Include\;C:\ExtractedGDK\241000\Microsoft GDK\241000\GXDK\gameKit\Include\XboxOne\;C:\ExtractedGDK\241000\Microsoft GDK\241000\GRDK\gameKit\Include\
Console_EndpointLibRoot = C:\ExtractedGDK\241000\Microsoft GDK\241000\GXDK\gameKit\Lib\amd64;C:\ExtractedGDK\241000\Microsoft GDK\241000\GXDK\gameKit\Lib\amd64\XboxOne;C:\ExtractedGDK\241000\Microsoft GDK\241000\GRDK\gameKit\Lib\amd64
Console_ExtLibPaths = C:\ExtractedGDK\241000\Microsoft GDK\241000\GRDK\ExtensionLibraries\Xbox.Services.API.C\ExtensionLibrary.props
Console_ExtLibPathsString = C:\ExtractedGDK\241000\Microsoft GDK\241000\GRDK\ExtensionLibraries\Xbox.Services.API.C\ExtensionLibrary.props
Console_GRDKExtLibNamesString = PlayFab.Party.Cpp|PlayFab.PartyXboxLive.Cpp|Xbox.Game.Chat.2.Cpp.API|Xbox.Services.API.C
Console_GRDKExtLibRoot = C:\ExtractedGDK\241000\Microsoft GDK\241000\GRDK\ExtensionLibraries\
Console_LibRoot = C:\Program Files (x86)\Windows Kits\10\Lib\10.0.19041.0\
Console_Libs = pixevt.lib;d3d12_x.lib;xgameplatform.lib;xgameruntime.lib;xmem.lib;xg_x.lib
Console_SdkIncludeRoot = C:\ExtractedGDK\241000\Microsoft GDK\241000\GRDK\ExtensionLibraries\Xbox.Services.API.C\Include;C:\ExtractedGDK\241000\Microsoft GDK\241000\GXDK\gameKit\Include\;C:\ExtractedGDK\241000\Microsoft GDK\241000\GXDK\gameKit\Include\XboxOne\;C:\ExtractedGDK\241000\Microsoft GDK\241000\GRDK\gameKit\Include\;C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um;C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared;C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\winrt;C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\cppwinrt;C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt;C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt;;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.30.30705\include;;
Console_SdkLibPath = C:\ExtractedGDK\241000\Microsoft GDK\241000\GRDK\ExtensionLibraries\Xbox.Services.API.C\Lib\x64\Release\v143;C:\ExtractedGDK\241000\Microsoft GDK\241000\GXDK\gameKit\Lib\amd64;C:\ExtractedGDK\241000\Microsoft GDK\241000\GXDK\gameKit\Lib\amd64\XboxOne;C:\ExtractedGDK\241000\Microsoft GDK\241000\GRDK\gameKit\Lib\amd64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.19041.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.19041.0\um\x64;C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\ucrt\x64;;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.30.30705\lib\onecore\x64
Console_SdkRoot = C:\ExtractedGDK\241000\Microsoft GDK\
Console_SdkToolPath = C:\ExtractedGDK\241000\Microsoft GDK\241000\GXDK\bin\XboxOne\
Console_UCRTRedistDebug = C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x64\ucrt\
Console_WindowsIncludeRoot = C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\
```

[返回本主題頂端。](#)

<a id="bwoi-scarlettreferences" />

### Gaming.Xbox.Scarlett.x64 程式庫與 include 參考

程式庫與 include 參考\_不\_需要直接覆寫，因為它們衍生自先前提及的已覆寫路徑。本節僅供參考。

這些參考定義於 Gaming.Xbox.Scarlett.x64 *Platform* 資料夾內的 *Platform.Edition.props* 中。屬性的建構方式如下。

```xml theme={null}
<Console_LibRoot>$(WindowsSDKDir)Lib\$(TargetPlatformVersion)\</Console_LibRoot>
<Console_EndpointLibRoot>$(DurangoXdkInstallPath)GXDK\gameKit\Lib\amd64;$(DurangoXdkInstallPath)GXDK\gameKit\Lib\amd64\Scarlett;$(DurangoXdkInstallPath)GRDK\gameKit\Lib\amd64</Console_EndpointLibRoot>
<Console_EndpointIncludeRoot>$(DurangoXdkInstallPath)GXDK\gameKit\Include\;$(DurangoXdkInstallPath)GXDK\gameKit\Include\Scarlett\;$(DurangoXdkInstallPath)GRDK\gameKit\Include\</Console_EndpointIncludeRoot>
<Console_WindowsIncludeRoot>$(WindowsSDKDir)Include\$(TargetPlatformVersion)\</Console_WindowsIncludeRoot>
<Console_Libs Condition="'$(Console_Libs)'==''">pixevt.lib;d3d12_xs.lib;xgameplatform.lib;xgameruntime.lib;xmem.lib;xg_xs.lib</Console_Libs>
<Console_UCRTRedistDebug>$(WindowsSDKDir)bin\$(TargetPlatformVersion)\x64\ucrt\</Console_UCRTRedistDebug>
<Console_SdkRoot>$(DurangoXdkInstallRoot)</Console_SdkRoot>
<Console_SdkIncludeRoot>$(Console_EndpointIncludeRoot);$(WindowsSDK_IncludePath);$(UniversalCRT_IncludePath);$(VC_VC_IncludePath);</Console_SdkIncludeRoot>
<Console_SdkLibPath>$(Console_EndpointLibRoot);$(WindowsSDK_LibraryPath_x64);$(UniversalCRT_LibraryPath_x64);$(VC_LibraryPath_VC_x64_OneCore)</Console_SdkLibPath>
```

MSBuild 記錄中程式庫與 include 屬性的定義範例：

```text theme={null}
Console_EndpointIncludeRoot = C:\ExtractedGDK\241000\Microsoft GDK\241000\GXDK\gameKit\Include\;C:\ExtractedGDK\241000\Microsoft GDK\241000\GXDK\gameKit\Include\Scarlett\;C:\ExtractedGDK\241000\Microsoft GDK\241000\GRDK\gameKit\Include\
Console_EndpointLibRoot = C:\ExtractedGDK\241000\Microsoft GDK\241000\GXDK\gameKit\Lib\amd64;C:\ExtractedGDK\241000\Microsoft GDK\241000\GXDK\gameKit\Lib\amd64\Scarlett;C:\ExtractedGDK\241000\Microsoft GDK\241000\GRDK\gameKit\Lib\amd64
Console_ExtLibPaths = C:\ExtractedGDK\241000\Microsoft GDK\241000\GRDK\ExtensionLibraries\Xbox.Services.API.C\ExtensionLibrary.props
Console_ExtLibPathsString = C:\ExtractedGDK\241000\Microsoft GDK\241000\GRDK\ExtensionLibraries\Xbox.Services.API.C\ExtensionLibrary.props
Console_GRDKExtLibNamesString = PlayFab.Party.Cpp|PlayFab.PartyXboxLive.Cpp|Xbox.Game.Chat.2.Cpp.API|Xbox.Services.API.C
Console_GRDKExtLibRoot = C:\ExtractedGDK\241000\Microsoft GDK\241000\GRDK\ExtensionLibraries\
Console_LibRoot = C:\Program Files (x86)\Windows Kits\10\Lib\10.0.19041.0\
Console_Libs = pixevt.lib;d3d12_xs.lib;xgameplatform.lib;xgameruntime.lib;xmem.lib;xg_xs.lib
Console_SdkIncludeRoot = C:\ExtractedGDK\241000\Microsoft GDK\241000\GRDK\ExtensionLibraries\Xbox.Services.API.C\Include;C:\ExtractedGDK\241000\Microsoft GDK\241000\GXDK\gameKit\Include\;C:\ExtractedGDK\241000\Microsoft GDK\241000\GXDK\gameKit\Include\Scarlett\;C:\ExtractedGDK\241000\Microsoft GDK\241000\GRDK\gameKit\Include\;C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um;C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared;C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\winrt;C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\cppwinrt;C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt;C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt;;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.30.30705\include;;
Console_SdkLibPath = C:\ExtractedGDK\241000\Microsoft GDK\241000\GRDK\ExtensionLibraries\Xbox.Services.API.C\Lib\x64\Release\v143;C:\ExtractedGDK\241000\Microsoft GDK\241000\GXDK\gameKit\Lib\amd64;C:\ExtractedGDK\241000\Microsoft GDK\241000\GXDK\gameKit\Lib\amd64\Scarlett;C:\ExtractedGDK\241000\Microsoft GDK\241000\GRDK\gameKit\Lib\amd64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.19041.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.19041.0\um\x64;C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\ucrt\x64;;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.30.30705\lib\onecore\x64
Console_SdkRoot = C:\ExtractedGDK\241000\Microsoft GDK\
Console_SdkToolPath = C:\ExtractedGDK\241000\Microsoft GDK\241000\GXDK\bin\Scarlett\
Console_UCRTRedistDebug = C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x64\ucrt\
Console_WindowsIncludeRoot = C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\
```

[返回本主題頂端。](#)

<a id="bwoi-xboxextensions" />

### Gaming.Xbox.XboxOne.x64 和 Gaming.Xbox.Scarlett.x64 延伸程式庫

Xbox.Services.API.C、Xbox.Game.Chat.2.Cpp.API、Xbox.XCurl.API、Xbox.LibHttpClient、PlayFab.Party.Cpp 和 PlayFab.PartyXboxLive.Cpp 都有延伸程式庫。如果您使用這些功能，應根據下列 .props 檔案中的定義，將它們匯入您的專案並覆寫相關聯的屬性。

**Microsoft GDK (2024 年 10 月) 或更新版本：**

* *C:\ExtractedGDK\241000\Microsoft GDK\241000\GRDK\ExtensionLibraries\Xbox.Services.API.C\ExtensionLibrary.props*
* *C:\ExtractedGDK\241000\Microsoft GDK\241000\GRDK\ExtensionLibraries\Xbox.Game.Chat.2.Cpp.API\ExtensionLibrary.props*
* *C:\ExtractedGDK\241000\Microsoft GDK\241000\GRDK\ExtensionLibraries\PlayFab.Party.Cpp\ExtensionLibrary.props*
* *C:\ExtractedGDK\241000\Microsoft GDK\241000\GRDK\ExtensionLibraries\PlayFab.PartyXboxLive.Cpp\ExtensionLibrary.props*
* *C:\ExtractedGDK\241000\Microsoft GDK\220600\GRDK\ExtensionLibraries\PlayFab.Services.C\ExtensionLibrary.props*

**Microsoft GDK (2024 年 6 月) 或更早版本：**

* *C:\ExtractedGDK\241000\Microsoft GDK\230600\GRDK\ExtensionLibraries\Xbox.Services.API.C\DesignTime\CommonConfiguration\Neutral\ExtensionLibrary.props*
* *C:\ExtractedGDK\241000\Microsoft GDK\230600\GRDK\ExtensionLibraries\Xbox.Game.Chat.2.Cpp.API\DesignTime\CommonConfiguration\neutral\ExtensionLibrary.props*
* *C:\ExtractedGDK\241000\Microsoft GDK\230600\GRDK\ExtensionLibraries\PlayFab.Party.Cpp\DesignTime\CommonConfiguration\neutral\ExtensionLibrary.props*
* *C:\ExtractedGDK\241000\Microsoft GDK\230600\GRDK\ExtensionLibraries\PlayFab.PartyXboxLive.Cpp\DesignTime\CommonConfiguration\neutral\ExtensionLibrary.props*
* *C:\ExtractedGDK\241000\Microsoft GDK\230600\GRDK\ExtensionLibraries\PlayFab.Services.C\DesignTime\CommonConfiguration\neutral\ExtensionLibrary.props*

> 注意：Xbox.Services.API.C 的 .props 檔案已新增 Appnotify.lib、crypt32.lib 和 winhttp.lib 作為額外的相依性。

延伸程式庫屬性定義於目標平台資料夾內的 *Platform.Edition.props* 中。這些屬性的建構方式範例如下。

```xml theme={null}
<GDKExtLibNames Condition="'$(GDKExtLibNames)'==''">Xbox.Services.API.C</GDKExtLibNames>
<Console_GRDKExtLibRoot>$(DurangoXdkInstallPath)GRDK\ExtensionLibraries\</Console_GRDKExtLibRoot>
<Console_GRDKExtLibNamesString>$([System.String]::Join('|', $([System.IO.Directory]::GetDirectories(&quot;$(Console_GRDKExtLibRoot)&quot;))).Replace('$(Console_GRDKExtLibRoot)',''))</Console_GRDKExtLibNamesString>
<Console_ExtLibPathsString>$([System.Text.RegularExpressions.Regex]::Replace($(GDKExtLibNames), '($(Console_GRDKExtLibNamesString))','$(Console_GRDKExtLibRoot)%24%26\ExtensionLibrary.props'))</Console_ExtLibPathsString>
<Console_ExtLibPaths>$([MSBuild]::Unescape($(Console_ExtLibPathsString)))</Console_ExtLibPaths>
```

`GDKExtLibNames` 最多可定義五個程式庫。如果未定義此屬性，預設為 Xbox.Services.API.C。

[返回本主題頂端。](#)

<a id="bwoi-desktopprojects" />

## Gaming.Desktop.x64 專案自訂

若要從已解壓縮的 Microsoft Game Development Kit (GDK) 使用 MSBuild 建置 Gaming.Desktop.x64 專案，必須進行專案自訂。

<Note>
  Gaming.Desktop.x64、Gaming.Xbox.Scarlett.x64 和 Gaming.Xbox.XboxOne.x64 屬性覆寫之間的主要差異很小。最需要注意的是，Gaming.Desktop.x64 檔案位於 *GRDK* 路徑中，而 Gaming.Xbox.Scarlett.x64 和 Gaming.Xbox.XboxOne.x64 檔案位於 *GXDK* 路徑中 (延伸程式庫除外)。
</Note>

<a id="bwoi-desktopgdkoverrides" />

### GDK 的 Gaming.Desktop.x64 屬性覆寫

必須設定下列屬性，才能成功建置針對 Gaming.Desktop.x64 平台設定的專案。這些屬性應在您匯入專案檔中定義的 *Microsoft.Cpp.Default.props* 之前匯入。

#### 所覆寫屬性的說明

* `BWOI_GDK_Path`：非必要的使用者屬性，但我們建議您設定此屬性，以便在後續屬性值中使用，減少硬式編碼的路徑。
* `Platform`：指定用來編譯專案的平台。Microsoft Game Development Kit (GDK) 中的平台為 Gaming.Desktop.x64。
* `XdkEditionTarget`：覆寫用於建置編譯的 GDK 版本。此屬性定義於 *Platform.default.props* 中，並衍生自 `XdkEdition` (在 *xdk.props* 中設定的內部屬性)。
* `DurangoXdkInstallPath`：覆寫已解壓縮之 GDK 的 *Microsoft Game Development Kit (GDK)* 資料夾位置。它定義於 *Platform.Edition.default.props* 中。
* `DefaultXdkEditionRootVS2019`：覆寫與 Visual Studio 2019 相容之 `Platform` 屬性與目標檔案的預設位置。它定義於 *Platform.default.props* 中。只有在搭配 Visual Studio 2019 使用專案時，才應定義 `DefaultXdkEditionRootVS2019`。
* `XdkEditionRootVS2019`：覆寫與 Visual Studio 2019 相容之 `Platform` 屬性與目標檔案的位置。它定義於 *Platform.default.props* 中。只有在搭配 Visual Studio 2019 使用專案時，才應定義 `XdkEditionRootVS2019`。
* `DefaultXdkEditionRootVS2022`：覆寫與 Visual Studio 2022 相容之 `Platform` 屬性與目標檔案的預設位置。它定義於 *Platform.default.props* 中。只有在搭配 Visual Studio 2022 使用專案時，才應定義 `DefaultXdkEditionRootVS2022`。
* `XdkEditionRootVS2022`：覆寫與 Visual Studio 2022 相容之 `Platform` 屬性與目標檔案的位置。它定義於 *Platform.default.props* 中。只有在搭配 Visual Studio 2022 使用專案時，才應定義 `XdkEditionRootVS2022`。
* `PlatformToolset`：覆寫用於建置之建置工具的特定版本。Visual Studio 2019 支援 v142。Visual Studio 2022 支援 v142 和 v143 (預設定義為 v143)。此屬性定義於 *Microsoft.Cpp.Defaults.props* 中。

以下是根據先前已解壓縮資料夾範例的 Gaming.Desktop.x64 屬性值範例，供您參考：

```xml theme={null}
<BWOI_GDK_Path>C:\ExtractedGDK\241000\</BWOI_GDK_Path>
<Platform>Gaming.Desktop.x64</Platform>
<XdkEditionTarget>241000</XdkEditionTarget>
<DurangoXdkInstallPath>$(BWOI_GDK_Path)Microsoft GDK\</DurangoXdkInstallPath>
<DefaultXdkEditionRootVS2019>$(XdkEditionTarget)\GRDK\VS2019\flatDeployment\MSBuild\Microsoft\VC\v160\Platforms\$(Platform)\</DefaultXdkEditionRootVS2019>
<XdkEditionRootVS2019>$(DurangoXdkInstallPath)$(XdkEditionTarget)\GRDK\VS2019\flatDeployment\MSBuild\Microsoft\VC\v160\Platforms\$(Platform)\</XdkEditionRootVS2019>
<DefaultXdkEditionRootVS2022>$(XdkEditionTarget)\GRDK\VS2022\flatDeployment\MSBuild\Microsoft\VC\v170\Platforms\$(Platform)\</DefaultXdkEditionRootVS2022>
<XdkEditionRootVS2022>$(DurangoXdkInstallPath)$(XdkEditionTarget)\GRDK\VS2022\flatDeployment\MSBuild\Microsoft\VC\v170\Platforms\$(Platform)\</XdkEditionRootVS2022>
<PlatformToolset>$(PlatformToolset)</PlatformToolset>
```

若要覆寫 *Platform* 資料夾以偵測 Gaming.Desktop.x64 特定的 .props 和目標，請參閱下一節有關 Visual Studio 平台覆寫的說明。

[返回本主題頂端。](#)

<a id="bwoi-desktopsdkoverrides" />

### Windows 10 SDK 的 Gaming.Desktop.x64 屬性覆寫

只有在使用已解壓縮的 Windows 10 SDK 時，才需要設定下列屬性。如果您使用的是已安裝的 Windows 10 SDK，可以略過本節。

* `BWOI_Win10SDK_Path`：非必要的使用者屬性，但我們建議您設定此屬性，以便在後續屬性值中使用，減少硬式編碼的路徑。
* `WindowsSdkDir`：覆寫 Windows 10 SDK 的位置。
* `WindowsSdkDir_10`：覆寫 Windows 10 SDK (Windows 10) 的位置。此屬性會透過 *Microsoft.Cpp.WindowsSDK.props* 中的登錄機碼進行檢查，該檔案會在建置編譯期間匯入。
* `UCRTContentRoot`：覆寫通用 CRT 內容根目錄的位置。此屬性定義於 *uCRT.props* 中。
* `UniversalCRTSdkDir`：覆寫通用 CRT SDK (Visual C++ C 執行階段) 的位置。它會透過 *Microsoft.Cpp.WindowsSDK.props* 中的登錄機碼進行檢查，該檔案會在建置編譯期間匯入。
* `UniversalCRTSdkDir_10`：覆寫通用 CRT SDK (適用於 Windows 10 的 Visual C++ C 執行階段) 的位置。它會透過 *Microsoft.Cpp.WindowsSDK.props* 中的登錄機碼進行檢查，該檔案會在建置編譯期間匯入。
* `WindowsSDK_ExecutablePath_x86`：覆寫 Windows 10 SDK 所包含之 x86 工具的位置。`rc.exe` 等工具位於此位置。它定義於 *Microsoft.Cpp.WindowsSDK.props* 中。
* `WindowsSDK_ExecutablePath_x64`：覆寫 Windows 10 SDK 所包含之 x64 工具的位置。`rc.exe` 等工具位於此位置。它定義於 *Microsoft.Cpp.WindowsSDK.props* 中。
* `WindowsTargetPlatformVersion`：覆寫所使用的 Windows 10 SDK 版本。它定義於 *Platform.Edition.default.props* 資料夾中 (若未定義，則會逐一檢查本機路徑)。
* `TargetPlatformVersion`：覆寫所使用的 Windows 10 SDK 版本。它定義於 *Microsoft.Cpp.WindowsSDK.props* 中。

以下是根據先前已解壓縮資料夾範例的屬性值範例，供您參考：

```xml theme={null}
<BWOI_Win10SDK_Path>C:\ExtractedWin10SDK\</BWOI_Win10SDK_Path>
<WindowsSdkDir>$(BWOI_Win10SDK_Path)Windows Kits\10\</WindowsSdkDir>
<WindowsSdkDir_10>$(WindowsSdkDir)</WindowsSdkDir_10>
<UCRTContentRoot>$(WindowsSdkDir)</UCRTContentRoot>
<UniversalCRTSdkDir>$(WindowsSdkDir)</UniversalCRTSdkDir>
<UniversalCRTSdkDir_10>$(WindowsSdkDir)</UniversalCRTSdkDir_10>
<WindowsSDK_ExecutablePath_x86>$(WindowsSdkDir)bin\$(WindowsTargetPlatformVersion)\x86</WindowsSDK_ExecutablePath_x86>
<WindowsSDK_ExecutablePath_x64>$(WindowsSdkDir)bin\$(WindowsTargetPlatformVersion)\x64</WindowsSDK_ExecutablePath_x64>
<WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion>
<TargetPlatformVersion>$(WindowsTargetPlatformVersion)</TargetPlatformVersion>
```

> Microsoft GDK 需要 Windows 10 SDK (19041) 或更新版本。您可以視需要使用 Windows 10 SDK (20348)，但這不是必要的。

[返回本主題頂端。](#)

<a id="bwoi-desktopreferences" />

### Gaming.Desktop.x64 程式庫與 include 參考

程式庫與 include 參考\_不\_需要直接覆寫，因為它們衍生自先前提及的已覆寫路徑。本節僅供參考。

這些參考定義於 Gaming.Desktop.x64 *Platform* 資料夾內的 *Platform.Edition.props* 中。屬性的建構方式如下。

```xml theme={null}
<Console_LibRoot>$(WindowsSDKDir)Lib\$(TargetPlatformVersion)\</Console_LibRoot>
<Console_EndpointLibRoot>$(DurangoXdkInstallPath)GRDK\gameKit\Lib\amd64</Console_EndpointLibRoot>
<Console_EndpointIncludeRoot>$(DurangoXdkInstallPath)GRDK\gameKit\Include\</Console_EndpointIncludeRoot>
<Console_WindowsIncludeRoot>$(WindowsSDKDir)Include\$(TargetPlatformVersion)\</Console_WindowsIncludeRoot>
<Console_Libs>dxguid.lib;D3D12.lib;dxgi.lib;runtimeobject.lib;xGameRuntime.lib;</Console_Libs>
<Console_UCRTRedistDebug>$(WindowsSDKDir)bin\$(TargetPlatformVersion)\x64\ucrt\</Console_UCRTRedistDebug>
<Console_SdkRoot>$(DurangoXdkInstallRoot)</Console_SdkRoot>
<Console_SdkIncludeRoot>$(Console_EndpointIncludeRoot);$(WindowsSDK_IncludePath);$(UniversalCRT_IncludePath);$(VC_VC_IncludePath);</Console_SdkIncludeRoot>
<Console_SdkLibPath>$(Console_EndpointLibRoot);$(Console_LibRoot)um\x64;$(Console_LibRoot)ucrt\x64</Console_SdkLibPath>
```

MSBuild 記錄中程式庫與 include 屬性的定義範例：

```bash theme={null}
Console_EndpointIncludeRoot = C:\ExtractedGDK\241000\Microsoft GDK\241000\GRDK\gameKit\Include\
Console_EndpointLibRoot = C:\ExtractedGDK\241000\Microsoft GDK\241000\GRDK\gameKit\Lib\amd64
Console_ExtLibPaths = C:\ExtractedGDK\241000\Microsoft GDK\241000\GRDK\ExtensionLibraries\Xbox.Services.API.C\ExtensionLibrary.props
Console_ExtLibPathsString = C:\ExtractedGDK\241000\Microsoft GDK\241000\GRDK\ExtensionLibraries\Xbox.Services.API.C\ExtensionLibrary.props
Console_GRDKExtLibNamesString = PlayFab.Party.Cpp|PlayFab.PartyXboxLive.Cpp|Xbox.Game.Chat.2.Cpp.API|Xbox.Services.API.C
Console_GRDKExtLibRoot = C:\ExtractedGDK\241000\Microsoft GDK\241000\GRDK\ExtensionLibraries\
Console_LibRoot = C:\Program Files (x86)\Windows Kits\10\Lib\10.0.19041.0\
Console_Libs = dxguid.lib;D3D12.lib;dxgi.lib;runtimeobject.lib;xGameRuntime.lib;
Console_SdkIncludeRoot = C:\ExtractedGDK\241000\Microsoft GDK\241000\GRDK\ExtensionLibraries\Xbox.Services.API.C\Include;C:\ExtractedGDK\241000\Microsoft GDK\241000\GRDK\gameKit\Include\;C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um;C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared;C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\winrt;C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\cppwinrt;C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt;C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt;;C:\Program Files (x86)\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.30.30705\include;;
Console_SdkLibPath = C:\ExtractedGDK\241000\Microsoft GDK\241000\GRDK\ExtensionLibraries\Xbox.Services.API.C\Lib\x64\Release\v143;C:\ExtractedGDK\241000\Microsoft GDK\241000\GRDK\gameKit\Lib\amd64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.19041.0\um\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.19041.0\ucrt\x64
Console_SdkRoot = C:\ExtractedGDK\241000\Microsoft GDK\
Console_WindowsIncludeRoot = C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\
```

[返回本主題頂端。](#)

<a id="bwoi-desktopextensions" />

### Gaming.Desktop.x64 延伸程式庫

Xbox.Services.API.C、Xbox.Game.Chat.2.Cpp.API、Xbox.XCurl.API、PlayFab.Party.Cpp 和 PlayFab.PartyXboxLive.Cpp 都有延伸程式庫。如果您使用這些功能，應根據下列 .props 檔案中的定義，將它們匯入您的專案並覆寫適當的屬性。

* *C:\ExtractedGDK\241000\Microsoft GDK\241000\GRDK\ExtensionLibraries\Xbox.Services.API.C\ExtensionLibrary.props*
* *C:\ExtractedGDK\241000\Microsoft GDK\241000\GRDK\ExtensionLibraries\Xbox.Game.Chat.2.Cpp.API\ExtensionLibrary.props*
* *C:\ExtractedGDK\241000\Microsoft GDK\241000\GRDK\ExtensionLibraries\PlayFab.Party.Cpp\ExtensionLibrary.props*
* *C:\ExtractedGDK\241000\Microsoft GDK\241000\GRDK\ExtensionLibraries\PlayFab.PartyXboxLive.Cpp\ExtensionLibrary.props*

> 注意：Xbox.Services.API.C 的 .props 檔案已新增 Appnotify.lib 作為額外的相依性，您必須將該程式庫匯入您的專案。

延伸程式庫屬性定義於目標平台資料夾內的 *Platform.Edition.props* 中。這些屬性的建構方式範例如下。

```xml theme={null}
<GDKExtLibNames Condition="'$(GDKExtLibNames)'==''">Xbox.Services.API.C</GDKExtLibNames>
<Console_GRDKExtLibRoot>$(DurangoXdkInstallPath)GRDK\ExtensionLibraries\</Console_GRDKExtLibRoot>
<Console_GRDKExtLibNamesString>$([System.String]::Join('|', $([System.IO.Directory]::GetDirectories(&quot;$(Console_GRDKExtLibRoot)&quot;))).Replace('$(Console_GRDKExtLibRoot)',''))</Console_GRDKExtLibNamesString>
<Console_ExtLibPathsString>$([System.Text.RegularExpressions.Regex]::Replace($(GDKExtLibNames), '($(Console_GRDKExtLibNamesString))','$(Console_GRDKExtLibRoot)%24%26\ExtensionLibrary.props'))</Console_ExtLibPathsString>
<Console_ExtLibPaths>$([MSBuild]::Unescape($(Console_ExtLibPathsString)))</Console_ExtLibPaths>
```

`GDKExtLibNames` 最多可定義五個程式庫。如果未定義，預設為 Xbox.Services.API.C。

[返回本主題頂端。](#)

<a id="bwoi-pctools" />

## PC 端工具的屬性覆寫

以已解壓縮的平面部署方式使用 Microsoft Game Development Kit (GDK) 時，如果您也使用 PC 端工具，建議您定義這些屬性。

```xml theme={null}
<GameDK>$(BWOI_Win10SDK_Path)</GameDK>
<GameDKLatest>$(BWOI_Win10SDK_Path)$(XDKEditionTarget)\</GameDKLatest>
<GRDKLatest>$(GameDKLatest)GRDK\</GRDKLatest>
<GXDKLatest>$(GameDKLatest)GXDK\</GXDKLatest>
```

<a id="bwoi-vsoverrides" />

## Visual Studio 版本特定的覆寫

本節詳細說明為了讓不安裝即建置正常運作而必須覆寫的 Visual Studio 版本特定屬性。

<a id="bwoi-vs2019overrides" />

### Visual Studio 2019 平台覆寫

從 Visual Studio 2019 開始，`_PlatformFolder` 屬性已被取代。在 Visual Studio 2019 中，支援不安裝即進行專案設定的解決方案需要額外的步驟。

若要執行此動作，請將所需的檔案從已安裝的 Visual Studio 2019 版本複製到已解壓縮的 GDK 路徑。例如：

* 適用於 v142 Platform Toolset：*C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v160*

這些檔案應依照下列路徑的資料夾結構進行複製。

* 適用於 v142 Platform Toolset：*C:\ExtractedGDK\241000\Microsoft GDK\241000\GRDK\VS2019\flatDeployment\MSBuild\Microsoft\VC\v160\Platforms*

<Note>
  先前的範例會將檔案直接複製到您的 *ExtractedGDK* 資料夾。如果您想將已解壓縮的 GDK 與 Visual Studio VC Targets 檔案分開存放以便參考/維護，可以將 *ExtractedGDK* 和 VC Targets 都複製到如先前所述的新合併資料夾路徑，供您的建置系統參考。

  範例如下。

  * 將 *C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v160* 根目錄中的所有檔案 (\*.\*) 複製到 *C:\ExtractedGDK\241000\_CombinedGDK\\* 資料夾內的類似路徑。
  * 將 *C:\ExtractedGDK\241000\Microsoft GDK* 中的所有檔案複製到 *C:\ExtractedGDK\241000\_CombinedGDK\\* 資料夾內的類似路徑。
  * 變更 *references/paths/properties*，使其指向 *C:\ExtractedGDK\241000\_CombinedGDK\\* 的對等路徑。
</Note>

完成此動作後，在 Visual Studio 2019 中叫用建置時，必須覆寫下列屬性，才能正確找到 `Platform` 屬性與目標檔案位置。

* 將 `DisableInstalledVCTargetsUse` 設定為 `true`
* `VCTargetsPath16`：覆寫 Visual Studio 路徑，以判斷 Visual Studio 2019 Build Tools (v160) 屬性與目標檔案的位置。

<Note>
  由於 VC Targets Path 屬性是定義 `XdkEditionRootVS2019` 屬性的一部分，因此在此情況下，您可以選擇不設定 `XdkEditionRootVS2019`。
</Note>

以下是根據先前已解壓縮資料夾範例的屬性值範例，供您參考：

```xml theme={null}
<DisableInstalledVCTargetsUse>true</DisableInstalledVCTargetsUse>
<VCTargetsPath16>$(DurangoXdkInstallPath)$(XdkEditionTarget)\GXDK\VS2019\flatDeployment\MSBuild\Microsoft\VC\v160\</VCTargetsPath16>
```

<Note>
  如果您想將 *ExtractedGDK* 和 VC Targets 分開存放以便參考/維護，可以如下指定 `VCTargetsPath` 屬性 (其中 *\$(CombinedGDK)* 是您建立的新位置)。

  * 將 `VCTargetsPath16` 設定為 *\$(CombinedGDK)\v160\\*
</Note>

### 讓 Visual Studio 2019 (16.5) 遵循 Windows 10 SDK 覆寫的屬性

使用 Visual Studio 2019 16.5 版或更新版本時，還需要設定另一個屬性，以確保正確遵循 Windows 10 SDK 屬性覆寫，如下所示。

```text theme={null}
<ClearDevCommandPromptEnvVars>false</ClearDevCommandPromptEnvVars>
<VCToolsVersion />
```

[返回本主題頂端。](#)

<a id="bwoi-vs2022overrides" />

### Visual Studio 2022 平台覆寫

從 Visual Studio 2019 開始，`_PlatformFolder` 屬性已被取代。在 Visual Studio 2022 中，支援不安裝即進行專案設定的解決方案需要額外的步驟。

若要執行此動作，請將所需的檔案從已安裝的 Visual Studio 2022 版本複製到已解壓縮的 GDK 路徑。例如：

* 適用於 v142 Platform Toolset：*C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v160*
* 適用於 v143 Platform Toolset：*C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170*

這些檔案應依照下列路徑的資料夾結構進行複製。

* 適用於 v142 Platform Toolset：*C:\ExtractedGDK\241000\Microsoft GDK\241000\GRDK\VS2022\flatDeployment\MSBuild\Microsoft\VC\v160\Platforms*
* 適用於 v143 Platform Toolset：*C:\ExtractedGDK\241000\Microsoft GDK\241000\GRDK\VS2022\flatDeployment\MSBuild\Microsoft\VC\v170\Platforms*

<Note>
  先前的範例會將檔案直接複製到您的 *ExtractedGDK* 資料夾。如果您想將已解壓縮的 GDK 與 Visual Studio VC Targets 檔案分開存放以便參考/維護，可以將 *ExtractedGDK* 和 VC Targets 都複製到如先前所述的新合併資料夾路徑，供您的建置系統參考。

  範例如下。

  * 將 *C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170* 根目錄中的所有檔案 (\*.\*) 複製到 *C:\ExtractedGDK\241000\_CombinedGDK\\* 資料夾內的類似路徑。
  * 將 *C:\ExtractedGDK\241000\Microsoft GDK* 中的所有檔案複製到 *C:\ExtractedGDK\241000\_CombinedGDK\\* 資料夾內的類似路徑。
  * 變更 *references/paths/properties*，使其指向 *C:\ExtractedGDK\241000\_CombinedGDK\\* 的對等路徑。
</Note>

完成此動作後，在 Visual Studio 2022 中叫用建置時，必須覆寫下列屬性，才能正確找到 `Platform` 屬性與目標檔案位置。

* 將 `DisableInstalledVCTargetsUse` 設定為 `true`
* `VCTargetsPath16`：覆寫 Visual Studio 路徑，以判斷 Visual Studio 2019 Build Tools (v160) 屬性與目標檔案的位置。
* `VCTargetsPath17`：覆寫 Visual Studio 路徑，以判斷 Visual Studio 2022 Build Tools (v170) 屬性與目標檔案的位置。

<Note>
  由於 VC Targets Path 屬性是定義 `XdkEditionRootVS2022` 屬性的一部分，因此在此情況下，您可以選擇不設定 `XdkEditionRootVS2022`。
</Note>

以下是根據先前已解壓縮資料夾範例的屬性值範例，供您參考：

```xml theme={null}
<DisableInstalledVCTargetsUse>true</DisableInstalledVCTargetsUse>
<VCTargetsPath16>$(DurangoXdkInstallPath)$(XdkEditionTarget)\GXDK\VS2022\flatDeployment\MSBuild\Microsoft\VC\v160\</VCTargetsPath16>
<VCTargetsPath17>$(DurangoXdkInstallPath)$(XdkEditionTarget)\GXDK\VS2022\flatDeployment\MSBuild\Microsoft\VC\v170\</VCTargetsPath17>
```

<Note>
  如果您想將 *ExtractedGDK* 和 VC Targets 分開存放以便參考/維護，可以如下指定 `VCTargetsPath` 屬性 (其中 *\$(CombinedGDK)* 是您建立的新位置)。

  * 將 `VCTargetsPath16` 設定為 *\$(CombinedGDK)\v160\\*
  * 將 `VCTargetsPath17` 設定為 *\$(CombinedGDK)\v170\\*
</Note>

### 讓 Visual Studio 2022 遵循 Windows 10 SDK 覆寫的屬性

此外，還需要設定另一個屬性，以確保正確遵循 Windows 10 SDK 屬性覆寫，如下所示。

```xml theme={null}
<ClearDevCommandPromptEnvVars>false</ClearDevCommandPromptEnvVars>
```

[返回本主題頂端。](#)

<a id="bwoi-samples" />

## 專案設定範例

本節說明如何取得不安裝情境的程式碼範例。

<a id="bwoi-cmakesample" />

### CMake 範例

您可以從 [XBOX Developer Downloads](https://aka.ms/gdkdl) 頁面下載 **CMakeExample** 範例 (包括快速上手的指示) 以供參考。在 "Select file type" 底下選擇 "GDK"，然後在 "Select build/version number" 底下選擇最新的 "Samples only" 項目。

[返回本主題頂端。](#)

<a id="bwoi-msbuildsample" />

### MSBuild 範例

您可以從 [XBOX Developer Downloads](https://aka.ms/gdkdl) 頁面下載 **BWOIExample** 範例 (包括快速上手的指示) 以供參考。在 "Select file type" 底下選擇 "GDK"，然後在 "Select build/version number" 底下選擇最新的 "Samples only" 項目。

[返回本主題頂端。](#)

<a id="bwoi-seealso" />

## 另請參閱

[在不安裝 Microsoft Game Development Kit (GDK) 的情況下設定建置環境](/zh-TW/build/console-features/build-without-install/build-environment-withoutinstall)

[不安裝 Microsoft Game Development Kit 即建置的概觀](/zh-TW/build/console-features/build-without-install/withoutinstall-overview)


## Related topics

- [設定並安裝 GDK](/zh-TW/home/setup-install/get-started.md)
- [搭配 Unity 使用 GDK](/zh-TW/build/gdk-and-engines/unity/unity.md)
- [PC 遊戲開發的 Visual Studio 專案範本](/zh-TW/tools/tools-pc/visualstudio/gr-vs-templates.md)
- [使用 GDK 專案範本開始新的 PC 遊戲](/zh-TW/build/gdk-and-engines/guides/gdk-project-templates.md)
- [GSDK 專案雲端部署](/zh-TW/services/playfab/multiplayer/servers/server-sdks/unreal-gsdk/third-person-mp-example-project-cloud-deployment.md)
