注意
本主题中介绍的标头和库的新Microsoft游戏开发工具包 (GDK) 布局预计将在 2025 年 10 月 GDK 发布。 如果你对此 GDK 的预览版感兴趣,请联系Microsoft客户经理。
在当前版本的 Microsoft 游戏开发工具包 (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.x64、Gaming.Xbox.Scarlett.x64 和 Gaming.Xbox.XboxOne.x64 自定义 MSBuild 平台实现用于构建以各种方式组合所有这些内容的 include/lib 路径的所有逻辑。 如果使用了 CMake 或自定义生成解决方案,则必须同时实现此逻辑。 有关详细示例,请参阅 CMakeExample 的 2025 年 4 月版本。
旧布局在 2025 年 10 月 GDK 中仍然存在,以支持新旧样式。 默认情况下,将同时安装新布局和旧布局。 GDK 安装程序现在包括一个仅安装新布局的选项。 未来的 GDK 将删除旧布局,以减少硬盘占用空间和整体下载大小。 删除旧布局的当前目标日期为自 2025 年 10 月 GDK 发布之日起一年。
新的标头和库布局
对于 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 属性将列出核心所需的库。
| 平台 | 核心库 |
|---|---|
| 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 ,因为它们都是“选择加入”。
| 平台 | 核心库 |
|---|---|
| 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 或添加 props 文件以使用 ReferenceCopyLocalPaths 项组列表。 下面的 MSBuild 列出了所有可能的 DLL,但单个项目只需要其中一些 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 扩展的 GDK Microsoft 设置。 因此,我们引入了完全支持并排安装两个版本的 Microsoft GDK 的新环境变量: GameDKCoreLatest 由 Microsoft GDK 设置。
GameDKXboxLatest 由 Microsoft GDK 和 Xbox 扩展设置。
使用 Directory.Build.props
为了使用新布局快速验证现有 GDK Gaming.*.x64 项目,请将以下内容放入源树中名为 Directory.Build.props 的文件中。 这将选择加入新布局,并包括大多数或所有扩展库,即使项目未使用也是如此。
注意
当将 GDKCrossPlatform 设置为 true 时,MSBuild 规则不使用 GDKExtLibNames 属性。 由于它已可用于使用较旧的 MSBuild 规则进行生成,因此它在此属性文件中用作在布局中选择加入其他 DLL 的一种方式。
<?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 平台配合使用
你可以使用常用 x64 平台为电脑生成,而不是使用 Gaming.Desktop.x64 平台。 在旧版式中,这需要为扩展库添加 <Import Project="...\ExtensionLibrary.props"> 语句,详见将 x64 平台与 Microsoft 游戏开发工具包 (GDK) 。
在新布局中,集成说明得到了简化。
<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 配合使用
将 Microsoft Visual Studio 生成器与 CMake 一起使用,以及使用 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%
使用电脑内容工具的新布局
对于主机开发,使用 XTF API、XMA2 编码库和/或自定义 Direct3D 12.X 工具在开发电脑上进行某些种类的内容“烹饪”。 访问此内容需要特定的生成设置:
构建面向 Xbox One 和 Xbox Series X|S 的电脑工具需要:
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图形的电脑工具需要:
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 图形的电脑工具需要:
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。
下面是 PowerShell 中的一个示例,该示例也适用于较旧的 GDK 版本。
$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>