> ## 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.

# MicrosoftGame.config 附加参考

> MicrosoftGame.config 附加参考

# MicrosoftGame.config 附加参考

## 摘要

本文介绍了 MicrosoftGame.config 文件的附加详细信息/参考资料。包含以下各节。

| 章节 | 描述 |
| - | - |
| [元素详细信息](#MicrosoftGameConfig-Elements) | 提供 MicrosoftGame.config 元素名称、用途和备注的列表。 |
| [MicrosoftGame.config 示例文件](#MicrosoftGameConfig-Example) | 提供适用于 XBOX 和 PC 的 MicrosoftGame.config 示例。 |
| [MicrosoftGame.config 的 XSD 架构](#XSD-Schema-id) | 提供用于验证 MicrosoftGame.config 的 XSD 架构的详细信息。 |
| [以前的元素参考](#MicrosoftGameConfig-OldElements) | 提供有关已更改的重要元素的列表，包括来自 ERA 的更改参考。 |
| [MicrosoftGame.config 与 DLC 创建](#MicrosoftGameConfig-DLC) | 提供有关为 DLC 产品创建 MicrosoftGame.config 的更多信息。 |
| [另请参阅](#MicrosoftGameConfig-SeeAlso) | 提供与 MicrosoftGame.config 相关的其他文档的链接。 |

### Game configVersion 详细信息

自 2022 年 3 月 Microsoft Game Development Kit (GDK) 起，对于使用 Microsoft Game Development Kit (GDK) 工具生成的新 MicrosoftGame.config 文件，Game configVersion 已从 0 更新为 1。自 2023 年 10 月 GDK 起，所有游戏都必须使用 configVersion="1"。对于使用 2023 年 10 月 GDK 且以 configVersion="0" 提交的任何游戏，Submission Validator 将报告 FAILURE。

Game configVersion 0 与 1 之间的变化如下。

* 如果在 MicrosoftGame.config 中指定了 MSAAppId 或 TitleId 之一，则两者都必须提供（例如，如果指定了 TitleId，则也必须指定 MSAAppId）。
* 如果指定了 NoCodePCRoot 元素或 AdvancedUserModel 元素被设置为 false，则必须提供 MSAAppId 和 TitleId 元素。
* 从 configVersion 1 起，ModFolder、EnableWritesToPackageRoot、DisableFilesystemWriteVirtualization 和 DisableRegistryWriteVirtualization 元素已弃用。

将对游戏运行哪些架构中定义的要求由 MicrosoftGame.config 中的以下值决定：

```xml theme={null}
<Game configVersion="1">
```

Game configVersion 允许值为 0 和 1。这些新要求不会影响升级到 2022 年 3 月 Microsoft Game Development Kit (GDK) 的现有游戏，因为它们的 Game configVersion 将保持为 0。

### 元素详细信息

本节详细说明 MicrosoftGame.config 中可定义元素的名称、是否必需、用途、父节点和其他备注。

| 节点名称 | 是否必需 | 用途 | 父级 | 备注 |
| - | - | - | - | - |
| [Game](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-game) | 必需 | 唯一的父节点，包含所有其他内容 | | |
|  [Identity](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-identity) | 必需 | 定义游戏的 Name、Publisher 和 Version | Game | 游戏信息可以在 Partner Center 的 Product Management -> Product Identity 中找到；请参阅[针对托管合作伙伴在 Partner Center 设置游戏](/zh-CN/services/xbox-services/fundamentals/portal-config/live-setup-partner-center-partners)。  在注册期间用于唯一标识游戏。  Name 和 Publisher 为必填字段。  如果未指定，Version 将默认为 1.0.0.0。  后续主机代次的其他包必须将包主版本递增到现有包版本之上。 |
|  [ShellVisuals](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-shellvisuals) | 打包构建时必需 | 定义游戏在 Shell 中的展现方式，例如图像和名称。 | Game | 在注册期间用于在 Shell 中展示游戏。 |
|  [Resources](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-resources) | 可选 | 用于本地化 Shell Visuals 的语言区域设置对列表。 | Game | 可从现有 AppxManifest 复制并粘贴，因为格式保持一致。  有关详细信息，请参阅[打包](/zh-CN/build/core-features/common/packaging/gc-packaging-toc)。 |
| [Resource](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-resource) | 可选 | Resources 列表中语言区域设置的单个条目。 | Resources | |
| [ExecutableList](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-executablelist) | 必需 | 游戏可执行文件列表。 | Game | 至少需要一个条目才能成功注册或打包游戏。  "IsDevOnly" 属性允许你确保此条目不会包含在提交签名包中。  Display Name 和 Logo 的覆盖允许在 Shell 中为此 exe 设置独有的值（除非在此处另行覆盖，否则上面在 "ShellVisuals" 节点中指定的资源将作为每个 exe 的默认值）。 |
|  [Executable](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-executable) | 必需 | 指定特定可执行文件的详细信息。 | ExecutableList | 此节的属性包括：可执行文件名称 (Name)、构建目标设备 (TargetDeviceFamily)、Application ID (Id)、是否为仅开发用途的可执行文件 (IsDevOnly)、是否应覆盖 ShellVisuals 节点中的显示名称 (OverrideDisplayName)、是否应覆盖 ShellVisuals 节点中的 Logo (OverrideLogo)、是否应覆盖 ShellVisuals 节点中的 Square480x480Logo (OverrideSquare480x480Logo)、是否应覆盖 ShellVisuals 节点中的 Square44x44Logo (OverrideSquare44x44Logo)、是否应覆盖 ShellVisuals 节点中的 SplashScreenImage (OverrideSplashScreenImage)，以及可执行文件是否有别名 (Alias，目前仅桌面)。 |
|  [AdvancedUserModel](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-advancedusermodel) | 可选 | 指定你的游戏是否应使用高级用户模型。 | Game | 这意味着你的游戏支持在不需要重启的情况下更改活动用户。如果禁用，则使用简化用户模型 (Simplified User Model)，可确保你的游戏始终保留启动时的活动用户。有关详细信息，请参阅 [GDK 用户模型（NDA 主题）](/zh-CN/build/core-features/common/user/gamecore-user-models)。 |
|  [Protocol](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-protocol) | 可选 | 可用于启动游戏或（如果游戏已在运行）将游戏置于前台的自定义协议。 | ProtocolList | 指定自定义协议的名称以及可选的可执行文件路径。有关详细信息，请参阅[协议激活](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/overviews/protocolactivation)。 |
|  [ProtocolList](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-protocol) | 可选 | 指定可用于启动游戏或（如果游戏已在运行）将游戏置于前台的自定义协议集合。 | Game | 必须至少提供一个 Protocol。有关详细信息，请参阅[协议激活](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/overviews/protocolactivation)。 |
|  [GameOsVersion](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-gameosversion) | 可选（仅主机） | 指定该游戏运行所需的 Microsoft Game Development Kit (GDK) Game OS 版本。 | Game | 如果未指定，将使用当前正在运行的或默认的 Game OS。 |
|  [WindowsOsVersion](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-windowsosversion) | 可选（仅 PC） | 指定该游戏运行所需的最低和建议的 Windows 版本。 | DesktopRegistration | 允许值为四部分组成的版本号（例如 10.0.19045.3570），选项为 RequiredMinimum="#.#.#.#"、SuggestedMinimum="#.#.#.#"、Recommended="#.#.#.#"。此建议最低元素将默认设置为 10.0.19045.3570。 |
|  [MediaCapture](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-mediacapture) | 可选（仅主机） | 指定该游戏运行时系统媒体捕获应用的期望行为。 | Game | 媒体捕获要求正确配置游戏标识才能正常工作。 |
| [GameDVRSystemComponent](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-gamedvrsystemcomponent) | 可选（仅主机） | 指定是否启用 Game DVR 系统组件。 | MediaCapture | |
| [BlockBroadcast](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-blockbroadcast) | 可选（仅主机） | 指定是否阻止或允许游戏广播。 | MediaCapture | |
| [BlockGameDVR](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-blockgamedvr) | 可选（仅主机） | 指定是否阻止或允许游戏的 Game DVR 录制。 | MediaCapture | |
| [StoreId](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-storeid) | 可选 | 指定该游戏的商店标识。 | Game | 在 Partner Center 的 Product Management -> Product Identity 中指定。 |
| [AllowedProducts](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-allowedproducts) | 可选 | 指定此可下载内容包 (DLC) 所属的关联游戏的 StoreId。 | Game | 有关详细信息，请参阅[可下载内容包 (DLC)](/zh-CN/build/core-features/common/packaging/packaging-downloadable-content-dlc)。 |
| [AllowedProduct](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-allowedproduct) | 可选 | 指定此可下载内容包 (DLC) 所属的关联游戏的 StoreId。 | AllowedProducts | |
| [RelatedProducts](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-relatedproducts) | 可选 | 指定此 DLC 与之相关的产品的 StoreId。 | Game | 有关详细信息，请参阅[可下载内容包 (DLC)](/zh-CN/build/core-features/common/packaging/packaging-downloadable-content-dlc)。 |
| [RelatedProduct](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-relatedproduct) | 可选 | 此 DLC 与之相关的产品的 StoreId 的特定条目。 | RelatedProducts | |
| [TargetDeviceFamilyForDLC](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-targetdevicefamilyfordlc) | 可选（仅 DLC） | 指定 DLC 包构建所针对的目标平台。允许值为 XboxOne、Scarlett 和 PC。 | Game | |
| [PublisherContent](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-publishercontent) | 可选 | 声明此基础游戏支持发布者托管的内容包。 | Game | 有关详细信息，请参阅[发布者内容包](/zh-CN/build/core-features/common/packaging/packaging-publisher-content)。 |
| [ManifestUrl](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-manifesturl) | 可选 | 用于标识当前发布者托管内容包的 JSON 清单的 URL。 | PublisherContent | |
| [PublisherContentBaseProduct](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-publishercontentbaseproduct) | 可选（仅发布者内容） | 指定此发布者托管内容包所属的基础游戏的 StoreId。 | Game | 将该包标记为发布者内容包。 |
|  [PersistentLocalStorage](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-persistentlocalstorage) | 可选（仅主机） | 指定游戏持久本地存储的期望大小。 | Game | 持久本地存储要求正确配置游戏标识才能正常工作。 |
| [SizeMB](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-sizemb) | 可选（仅主机） | 指定持久本地存储的最小大小（以 MB 为单位）。 | PersistentLocalStorage | 持久本地存储要求正确配置游戏标识才能正常工作。 |
| [GrowableToMB](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-growabletomb) | 可选（仅主机） | 指定持久本地存储可随时间增长到的最大大小（以 MB 为单位）。 | PersistentLocalStorage | 持久本地存储要求正确配置游戏标识才能正常工作。 |
|  [VirtualMachine](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-virtualmachine) | 可选（仅主机） | 指定在特定 XBOX One 硬件上的游戏内存分配。 | Game | |
| [XboxOneXTitleMemory](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-xboxonextitlememory) | 可选（仅主机） | 指定 XBOX One X 主机的游戏内存设置。 | Virtual Machine | 允许值为 "Standard" 或 "Advanced"。 |
| [XboxLockhartTitleMemory](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-xboxlockharttitlememory) | 可选（仅主机） | 指定 XBOX Series S 主机的游戏内存设置。 | Virtual Machine | 允许值为 "Standard" 或 "Advanced"。 |
| [XboxAnacondaTitleMemory](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-xboxanacondatitlememory) | 可选（仅主机） | 指定 XBOX Series X 主机的游戏内存设置。 | Virtual Machine | 允许值为 "Standard" 或 "Advanced"。 |
|  [SMTEnabled](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-smtenabled) | 可选（仅主机） | 指定是否启用 SMT。 | Virtual Machine | |
|  [RequiresEraShim](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-requireserashim) | 可选（仅主机） | 指定是否需要 XBOX One ERA Shim。 | Virtual Machine | |
|  [XboxCompatibility](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-xboxcompatibility) | 可选（仅主机） | 指定该游戏兼容的最大主机代次。 | Virtual Machine | 开发者会在 XBOX One 游戏于 XBOX Series X\|S 上以向后兼容模式运行时使用此元素。主要用途是访问增强功能，如额外内存。允许值为 "XboxOne"（行为类似普通的向后兼容游戏）和 "Scarlett"（允许向后兼容游戏访问增强功能）。 |
|  [DlcCompatibility](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-dlccompatibility) | 可选（仅主机） | 指定游戏兼容的 DLC 的最低主机代次。 | Virtual Machine | 开发者会在 XBOX One 游戏于 XBOX Series X\|S 主机上运行但希望加载为 XBOX One 构建的 DLC 包时使用此元素。这将允许 DLC 存在于任何存储上，而不仅是快速存储上。 |
| [MSAFullTrust](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-msafulltrust) | 可选（仅 PC 桌面） | 指定该游戏是否声明为 "MSA Full Trust"。 | Game | 除非你的客户经理另行说明，否则不应使用。 |
| [MSAAppId](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-msaappid) | 必需 | 指定该游戏的 MSA App ID，与 XBOX Live Title ID（如下）一起用作 XBOX Live 服务的身份标识。 | Game | 自 2022 年 3 月 Microsoft Game Development Kit (GDK) 起，如果指定了 TitleId 元素，则必须存在 MSAAppId 元素。 |
| [TitleId](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-titleid) | 可选 | 指定该游戏的 XBOX Live Title ID，用作 XBOX Live 服务的身份标识。 | Game | 自 2022 年 3 月 Microsoft Game Development Kit (GDK) 起，如果指定了 MSAAppId 元素，则必须存在 TitleId 元素。 |
|  [RequiresXboxLive](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-requiresxboxlive) | 可选 | 指定该游戏运行时是否需要 XBOX Live 连接。 | Game | |
| [ExtendedAttributeList](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-extendedattributelist) | 可选 | 现有元素之外附加属性的备用容器。 | Game | 除非你的客户经理另行说明，否则不应使用。 |
| [ExtendedAttribute](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-extendedattribute) | 可选 | Extended Attribute List 中的特定备用指定。 | Game | 除非你的客户经理另行说明，否则不应使用。 |
| [DesktopRegistration](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-desktopregistration) | 可选（仅 PC 桌面） | 指定在 PC 桌面平台上注册游戏时使用的属性。 | Game | |
|  [ProcessorArchitecture](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-processorarchitecture) | 可选（仅 PC 桌面） | 指定与你的游戏可执行文件匹配的处理器架构。 | DesktopRegistration | 此元素的属性示例为 x64 和 x86。 |
| [MainPackageDependency](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-mainpackagedependency) | 可选（仅 PC 桌面 DLC） | 指定你的 DLC 所属的基础包标识。 | DesktopRegistration | |
|  [DependencyList](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-dependencylist) | 可选（仅 PC 桌面） | 确定在安装游戏包之前需要先安装哪些框架包。 | DesktopRegistration | 有关子元素用法的更多信息，请参阅 [Dependency](/zh-CN/reference/system/microsoftgameconfig/microsoftgameconfig-schema#MGC-Dependency)。 |
| [KnownDependency](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-knowndependency) | 可选（仅 PC 桌面） | 指定常用框架包之一的快捷方式。 | DependencyList | 必须指定 name 属性，MinVersion 会自动设置。有关可能的快捷方式列表，请参阅以下架构中的 ST\_KnownDependency 部分。 |
| [Dependency](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-dependency) | 可选（仅 PC 桌面） | 需要在游戏之前安装的特定框架包和版本。 | DependencyList | 必须设置 name 和 MinVersion 属性。 |
|  [CustomInstallActions](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-custominstallactions) | 可选（仅 PC 桌面） | 指定在游戏首次运行时具有管理员权限的自定义安装操作。 | DesktopRegistration | 你指定的任何可执行文件都必须位于游戏基础文件夹下的 "Installers" 文件夹中。请勿在 Installers 文件夹中包含任何其他文件。 |
| [Folder](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-folder) | 可选（仅 PC 桌面） | 指定安装程序的文件夹位置。 | CustomInstallActions | |
| [InstallActionList](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-installactionlist) | 可选（仅 PC 桌面） | 指定安装操作列表，包括可执行文件、名称和参数。 | CustomInstallActions | |
| [InstallAction](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-installaction) | 可选（仅 PC 桌面） | 在 Install Action 列表中指定一个安装操作。 | InstallActionList | 最多 100 个条目。 |
| [RepairActionList](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-repairactionlist) | 可选（仅 PC 桌面） | 指定修复操作列表。 | CustomInstallActions | |
| [RepairAction](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-repairaction) | 可选（仅 PC 桌面） | 在 Repair Action 列表中指定一个修复操作。 | RepairActionList | 最多 100 个条目。 |
| [UninstallActionList](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-uninstallactionlist) | 可选（仅 PC 桌面） | 指定卸载操作列表。 | CustomInstallActions | |
| [UninstallAction](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-uninstallaction) | 可选（仅 PC 桌面） | 在 Uninstall Action 列表中指定一个卸载操作。 | UninstallActionList | 最多 100 个条目。 |
| [ModFolder](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-modfolder) | 可选（仅 PC 桌面） | 定义游戏文件的最终用户 mods 的位置。 | DesktopRegistration | 自 2022 年 3 月 Microsoft Game Development Kit (GDK) 起，此元素已弃用。 |
|  [DisableRegistryWriteVirtualization](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-disableregistrywritevirtualization) | 可选（仅 PC 桌面） | 如果你的游戏必须进行操作系统范围的注册表写入，则设为 true。 | DesktopRegistration | 自 2022 年 3 月 Microsoft Game Development Kit (GDK) 起，此元素已弃用。 |
|  [DisableFilesystemWriteVirtualization](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-disablefilesystemwritevirtualization) | 可选（仅 PC 桌面） | 如果你的游戏必须进行操作系统范围的文件写入，则设为 true。 | DesktopRegistration | 自 2022 年 3 月 Microsoft Game Development Kit (GDK) 起，此元素已弃用。 |
|  [EnableWritesToPackageRoot](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-enablewritestopackageroot) | 可选（仅 PC 桌面） | 如果你的游戏需要写入包安装位置，则设为 true。 | DesktopRegistration | 自 2022 年 3 月 Microsoft Game Development Kit (GDK) 起，此元素已弃用。 |
|  [MultiplayerProtocol](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-multiplayerprotocol) | 可选（仅 PC 桌面） | 允许在游戏中通过 "ms-xbl-multiplayer" 协议进行协议激活。 | DesktopRegistration | 主要用于启用 XBOX Game Bar 启动游戏/多人游戏邀请。 |
|  [FileTypeAssociation](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-filetypeassociation) | 可选（仅 PC 桌面） | 允许将文件类型与你包中的可执行文件相关联。 | DesktopRegistration | 例如，某游戏地图编辑器的特定扩展名。有关详细信息，请参阅[文件类型激活](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/overviews/filetypeactivation)。 |
| [DisplayName](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-displayname) | 可选（仅 PC 桌面） | 指定文件类型关联的显示名称。 | FileTypeAssociation | |
| [Logo](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-logo) | 可选（仅 PC 桌面） | 指定文件类型关联的徽标。 | FileTypeAssociation | |
| [InfoTip](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-infotip) | 可选（仅 PC 桌面） | 指定文件类型关联的 Info Tip。 | FileTypeAssociation | |
| [EditFlags](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-editflags) | 可选（仅 PC 桌面） | 指定文件类型关联的 Edit Flags。 | FileTypeAssociation | |
| [SupportedFileTypes](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-supportedfiletypes) | 可选（仅 PC 桌面） | 指定文件类型关联所支持的文件类型。 | FileTypeAssociation | 有关详细信息，请参阅[文件类型激活](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/overviews/filetypeactivation)。 |
| [FileType](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-filetype) | 可选（仅 PC 桌面） | 指定作为 SupportedFileTypes 元素一部分使用的文件类型扩展名。 | SupportedFileTypes | 有关详细信息，请参阅[文件类型激活](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/overviews/filetypeactivation)。 |
| [NoCodePCRoot](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-nocodepcroot) | 可选（仅 PC 桌面） | 指定当为该包启用无代码云存档时用于存储游戏存档的本地文件夹。 | SaveGameStorage | |
|  [DevelopmentOnly](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-developmentonly) | 可选（仅主机） | 仅供开发使用的属性列表。 | Game | |
| [ContentIdOverride](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-contentidoverride) | 可选（仅主机） | 仅在开发时对游戏 ContentID 的覆盖。 | DevelopmentOnly | 在已安装包的情况下，使用 *xbapp list /d /nosystem* 命令来获取游戏的 ContentID。 |
| [EKBIDOverride](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-ekbidoverride) | 可选（仅主机） | 仅在开发时对游戏 EKBID（试用版 ID）的覆盖。 | DevelopmentOnly | 在已安装包的情况下，使用 *xbapp list /d* 命令来获取游戏的 EKBID。 |
| [DebugNetworkPortList](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-debugnetworkportlist) | 可选（仅主机） | 在开发套件上为开发打开的附加端口列表。 | DevelopmentOnly | |
| [DebugNetworkPort](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-debugnetworkport) | 可选（仅主机） | 在开发套件上为开发打开的附加端口。 | DebugNetworkPortList | |

[返回本文顶部。](/zh-CN/reference/system/microsoftgameconfig/microsoftgameconfig-schema)

## 错误代码

在使用 MicrosoftGame.config 文件时可能会遇到以下错误代码。有关完整列表，请参阅[错误代码](/zh-CN/reference/errorcodes)。

| 代码 | 值 | 描述 |
| - | - | - |
| E\_GAME\_MISSING\_GAME\_CONFIG | 0x87e5001F | 此应用缺少必需的 MicrosoftGame.Config 文件。 |
| E\_GAMERUNTIME\_OPTIONS\_NOT\_SUPPORTED | 0x8924010A | 传入的选项与游戏包不兼容。游戏配置信息必须与包匹配。 |
| E\_GAMERUNTIME\_GAMECONFIG\_BAD\_FORMAT | 0x8924010B | 传给 Initialize 的游戏配置无法被解析。 |
| E\_GAMEUSER\_NO\_TITLE\_ID | 0x89245108 | 必须配置 XBOX Live TitleId。 |
| E\_GAMEUSER\_UNKNOWN\_GAME\_IDENTITY | 0x89245109 | 无法识别游戏标识。MSAAppId 和 TitleId 与该游戏关联的值不匹配。 |
| E\_GAMEUSER\_INVALID\_APP\_CONFIGURATION | 0x89245112 | 游戏配置中的 MSAAppId 无效或未为身份验证堆栈配置。 |
| E\_GAMEUSER\_MALFORMED\_MSAAPPID | 0x89245113 | 游戏配置中的 MSAAppId 与预期格式（16 个字符字符串或 GUID）不匹配。 |
| E\_GAMEUSER\_INCONSISTENT\_MSAAPPID\_AND\_TITLEID | 0x89245114 | 游戏配置中的 MSAAppId 和 TitleId 与该游戏关联的值不匹配。 |
| E\_GAMEPACKAGE\_NO\_STORE\_ID | 0x89245202 | 必须在应用的游戏配置中设置 StoreId 属性。 |
| E\_GAMEPACKAGE\_DLC\_NOT\_SUPPORTED | 0x89245206 | 游戏不支持该 DLC 包。请确保游戏配置中的 DLC 兼容性正确。 |
| E\_GAMEPACKAGE\_DUPLICATE\_ID\_VALUES | 0x89245207 | 该包包含多个映射到同一 'ID' 属性的可执行文件。检查 'Executable' 元素中是否存在重复的 'ID' 属性。 |
| E\_GAMEPACKAGE\_CONFIG\_NO\_ROOT\_NODE | 0x89245209 | 在 MicrosoftGame.config 文件中找不到根 \<Game> 节点。检查该文件是否格式正确。 |
| E\_GAMEPACKAGE\_CONFIG\_ZERO\_VERSION | 0x8924520A | MicrosoftGame.config 中 'Identity' 节点内的 'Version' 属性不能为 0.0.0.0。请递增或移除此属性。如果未指定版本，默认值为 1.0.0.0。 |
| E\_GAMEPACKAGE\_CONFIG\_NO\_MSAAPPID\_NOTITLEID | 0x8924520B | MicrosoftGame.config 中缺少 'MSAAppId' 或 'TitleId' 元素。使用 configVersion >= 1 时，必须同时指定两者。 |
| E\_GAMEPACKAGE\_CONFIG\_DEPRECATED\_PC\_ENTRIES | 0x8924520C | DesktopRegistration 条目 "modFolder"、"enableWritesToPackageRoot"、"disableRegistryWriteVirtualization" 和 "disableFilesystemWriteVirtualization" 在 configVersion >= 1 中已弃用。 |
| E\_GAMEPACKAGE\_CONFIG\_SUM\_REQUIRES\_MSAAPPID | 0x8924520D | 在使用 Simplified User Model（AdvancedUserModel 元素）且 configVersion >= 1 时，需要 'MSAAppId' 和 'TitleId' 元素。 |
| E\_GAMEPACKAGE\_CONFIG\_NO\_CODE\_CLOUD\_SAVES\_REQUIRES\_MSAAPPID | 0x8924520E | 在使用无代码云存档（NoCodePCRoot 元素）且 configVersion >= 1 时，需要 'MSAAppId' 和 'TitleId' 元素。 |
| E\_GAMEPACKAGE\_CONFIG\_MSAAPPID\_OR\_TITLEID\_IS\_DEFAULT | 0x8924520F | 'MSAAppId' 或 'TitleId' 元素为默认值。如果指定了 NoCodePCRoot 或 AdvancedUserModel，使用 configVersion >= 1 时，TitleId 和 MSAAppId 都必须是来自 Partner Center 的有效 ID。 |

## MicrosoftGame.config 示例文件

以下 MicrosoftGame.config 是一个示例配置，展示了如何将各元素用于 XBOX Series X|S（并附带针对 XBOX One 差异的注释）。有关适用于 PC 的 MicrosoftGame.config 示例，请参阅 [PC 打包入门](/zh-CN/build/core-features/common/packaging/overviews/packaging-getting-started-for-PC)。

```xml theme={null}
<?xml version="1.0" encoding="utf-8"?>
<Game configVersion="1">
    
    <Identity Name="41336PublisherName.ExampleGame" Publisher="CN=A4954634-DF4B-47C7-AB70-D3215D246AF1" Version="1.6.0.0"/>
    
    <GameOsVersion>**REPLACE**</GameOsVersion>
    
    <MediaCapture>
        <GameDVRSystemComponent>true</GameDVRSystemComponent>
        <BlockBroadcast>0</BlockBroadcast>
        <BlockGameDVR>0</BlockGameDVR>
    </MediaCapture>
    
    <PersistentLocalStorage>
        <SizeMB>322</SizeMB>
    </PersistentLocalStorage>
    
    <MSAAppId>0000000000000000</MSAAppId>

    <TitleId>FFFFFFFF</TitleId>

    <StoreId>9NZTKMP36L8J</StoreId>
    
    <RelatedProducts>
        <RelatedProduct>9NZTKMP36L8J</RelatedProduct>
        <RelatedProduct>9NQJV5BMKR6C</RelatedProduct>
        <RelatedProduct>9PNX38847DWW</RelatedProduct>
    </RelatedProducts>
    
    <VirtualMachine>
        <XboxLockhartTitleMemory>Standard</XboxLockhartTitleMemory>
        <XboxAnacondaTitleMemory>Standard</XboxAnacondaTitleMemory>
        <!-- <XboxOneXTitleMemory>Standard</XboxOneXTitleMemory> if MicrosoftGame.config is for Xbox One instead of Xbox Series X&#124;S. -->
    </VirtualMachine>
    
    <MSAFullTrust>false</MSAFullTrust>
    
    <ExecutableList>
         <!-- TargetDeviceFamily="XboxOne" if the MicrosoftGame.config is for Xbox One instead of Xbox Series X&#124;S. -->
        <Executable Name="ExampleGame.exe"
            TargetDeviceFamily="Scarlett"
            Id="Game"
            IsDevOnly="false"
            OverrideDisplayName="Example Game"
            OverrideLogo="OverriddenLogo.png" />
        <Executable Name="ExampleGame_Debug.exe"
            IsDevOnly="true"/>
        <Executable Name="ExampleGame_Profile.exe"
            IsDevOnly="true" />
    </ExecutableList>
    
    <ShellVisuals DefaultDisplayName="Example Game"
        PublisherDisplayName="Example Publisher"
        StoreLogo="StoreLogoFile.png"
        Square150x150Logo="LogoFile150x150.png"
        Square44x44Logo="LogoFile44x44.png"
        Square480x480Logo="LogoFile480x480.png"
        Description="Example Game"
        ForegroundText="light"
        BackgroundColor="#ffffff"
        SplashScreenImage="SplashScreen.png"/>
    
    <Resources>
        <Resource Language="en-us"/>
        <Resource Language="de-de"/>
        <Resource Language="es-mx"/>
    </Resources>

    <DevelopmentOnly>
      <DebugNetworkPortList>
        <DebugNetworkPort>4600</DebugNetworkPort>
      </DebugNetworkPortList>
    </DevelopmentOnly>
</Game>
```

[返回本文顶部。](/zh-CN/reference/system/microsoftgameconfig/microsoftgameconfig-schema)

## MicrosoftGame.config 的 XSD 架构

MicrosoftGame.config 文件的最新架构以 GameConfigSchema.xsd 的形式位于 Microsoft Game Development Kit (GDK) 安装目录的 \<安装根目录>/bin 文件夹中。

请参阅以下 GameConfigSchema.xsd 示例：

```xml theme={null}
<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <!-- Types -->

    <xs:simpleType name="ST_NonEmptyString">
        <xs:restriction base="xs:string">
            <xs:minLength value="1"/>
            <xs:maxLength value="32767"/>
            <xs:pattern value="[^\s]|([^\s].*[^\s])"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="ST_GUID">
        <xs:restriction base="ST_NonEmptyString">
            <xs:pattern value="[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="ST_VersionQuad">
        <xs:restriction base="ST_NonEmptyString">
            <xs:pattern value="(0|[1-9][0-9]{0,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])(\.(0|[1-9][0-9]{0,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])){3}"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="ST_Hex8">
        <xs:restriction base="ST_NonEmptyString">
            <xs:pattern value="[0-9a-fA-F]{8}"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="ST_Hex16">
        <xs:restriction base="ST_NonEmptyString">
            <xs:pattern value="[0-9a-fA-F]{16}"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="ST_PLSSize">
        <xs:restriction base="xs:integer">
            <!-- The actual max is determined by policy -->
            <xs:maxInclusive value="100000"/>
            <xs:minInclusive value="10"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="ST_GrowablePLSSize">
        <xs:restriction base="xs:integer">
            <xs:minInclusive value="10"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:complexType name="CT_PersistentLocalStorage">
        <xs:all>
            <xs:element name="SizeMB" type="ST_PLSSize" minOccurs="0" maxOccurs="1"/>
            <xs:element name="GrowableToMB" type="ST_GrowablePLSSize" minOccurs="0" maxOccurs="1"/>
        </xs:all>
    </xs:complexType>

    <xs:simpleType name="ST_FileNameCharSet">
        <xs:restriction base="ST_NonEmptyString">
            <xs:pattern value="[^&lt;&gt;&quot;:%\|\?\*\x01-\x1f]+"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="ST_FileName">
        <xs:restriction base="ST_FileNameCharSet">
            <xs:pattern value="([^/\\]*[^./\\]+)(\\[^/\\]*[^./\\]+)*"/>
            <xs:pattern value="([^/\\]*[^./\\]+)(/[^/\\]*[^./\\]+)*"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="ST_FileNameNoPath">
        <xs:restriction base="ST_FileName">
            <xs:pattern value="[^\\/]+"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="ST_AsciiWindowsId">
        <xs:restriction base="ST_NonEmptyString">
            <xs:pattern value="([A-Za-z][A-Za-z0-9]*)(\.[A-Za-z][A-Za-z0-9]*)*"/>
            <xs:maxLength value="255"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="ST_DeviceFamily">
        <xs:restriction base="xs:string">
            <xs:enumeration value="XboxOne"/>
            <xs:enumeration value="Scarlett"/>
            <xs:enumeration value="PC"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="ST_ApplicationId">
        <xs:restriction base="ST_AsciiWindowsId">
            <xs:maxLength value="64"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="ST_StoreId">
        <xs:restriction base="xs:string">
            <xs:minLength value="12"/>
            <xs:maxLength value="12"/>
            <xs:pattern value="[0-9bcdfghjklmnpqrstvwxzBCDFGHJKLMNPQRSTVWXZ]{12}"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="ST_Executable">
        <xs:restriction base="ST_FileName">
            <xs:pattern value=".+\.([Ee][Xx][Ee])"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="ST_ExecutableNoPath">
        <xs:restriction base="ST_FileName">
            <xs:pattern value="[^\\]+\.([Ee][Xx][Ee])"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="ST_ImageFile">
        <xs:restriction base="ST_FileName">
            <xs:pattern value=".+\.(png)"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="ST_ResourceReference">
        <xs:restriction base="ST_NonEmptyString">
            <xs:pattern value="\bms-resource:.{1,256}"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="ST_DisplayName">
        <xs:union memberTypes="ST_ResourceReference">
            <xs:simpleType>
                <xs:restriction base="ST_NonEmptyString">
                    <xs:maxLength value="256"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:union>
    </xs:simpleType>

    <xs:simpleType name="ST_Description">
        <xs:restriction base="ST_NonEmptyString">
            <xs:pattern value="[^\x01-\x1f]+"/>
            <xs:maxLength value="2048"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="ST_ForegroundText">
        <xs:restriction base="xs:string">
            <xs:enumeration value="light"/>
            <xs:enumeration value="dark"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="ST_Color">
        <xs:restriction base="xs:string">
            <xs:pattern value="#[\da-fA-F]{6}"/>
            <xs:pattern value="aliceBlue|antiqueWhite|aqua|aquamarine|azure|beige|bisque|black|blanchedAlmond|blue|blueViolet|brown|burlyWood"/>
            <xs:pattern value="cadetBlue|chartreuse|chocolate|coral|cornflowerBlue|cornsilk|crimson|cyan|darkBlue|darkCyan|darkGoldenrod|darkGray"/>
            <xs:pattern value="darkGreen|darkKhaki|darkMagenta|darkOliveGreen|darkOrange|darkOrchid|darkRed|darkSalmon|darkSeaGreen|darkSlateBlue"/>
            <xs:pattern value="darkSlateGray|darkTurquoise|darkViolet|deepPink|deepSkyBlue|dimGray|dodgerBlue|firebrick|floralWhite|forestGreen"/>
            <xs:pattern value="fuchsia|gainsboro|ghostWhite|gold|goldenrod|gray|green|greenYellow|honeydew|hotPink|indianRed|indigo|ivory"/>
            <xs:pattern value="khaki|lavender|lavenderBlush|lawnGreen|lemonChiffon|lightBlue|lightCoral|lightCyan|lightGoldenrodYellow|lightGreen"/>
            <xs:pattern value="lightGray|lightPink|lightSalmon|lightSeaGreen|lightSkyBlue|lightSlateGray|lightSteelBlue|lightYellow|lime|limeGreen"/>
            <xs:pattern value="linen|magenta|maroon|mediumAquamarine|mediumBlue|mediumOrchid|mediumPurple|mediumSeaGreen|mediumSlateBlue|mediumSpringGreen"/>
            <xs:pattern value="mediumTurquoise|mediumVioletRed|midnightBlue|mintCream|mistyRose|moccasin|navajoWhite|navy|oldLace|olive|oliveDrab"/>
            <xs:pattern value="orange|orangeRed|orchid|paleGoldenrod|paleGreen|paleTurquoise|paleVioletRed|papayaWhip|peachPuff|peru|pink|plum"/>
            <xs:pattern value="powderBlue|purple|red|rosyBrown|royalBlue|saddleBrown|salmon|sandyBrown|seaGreen|seaShell|sienna|silver|skyBlue"/>
            <xs:pattern value="slateBlue|slateGray|snow|springGreen|steelBlue|tan|teal|thistle|tomato|transparent|turquoise|violet|wheat|white"/>
            <xs:pattern value="whiteSmoke|yellow|yellowGreen"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:complexType name="CT_Resources">
        <xs:sequence>
            <xs:element name="Resource" maxOccurs="200" minOccurs="0" >
                <xs:complexType>
                    <xs:attribute name="Language" type="xs:language" use="required"/>
                </xs:complexType>
            </xs:element>
        </xs:sequence>
    </xs:complexType>

     <xs:complexType name="CT_Identity">
        <xs:attribute name="Name" type="ST_PackageName" use="required"/>
        <xs:attribute name="Publisher" type="ST_Publisher" use="required"/>
        <xs:attribute name="ResourceId" type="ST_ResourceId" use="optional"/>
        <xs:attribute name="Version" type="ST_VersionQuad" use="optional"/>
    </xs:complexType>

    <xs:complexType name="CT_ShellVisuals">
        <xs:attribute name="DefaultDisplayName" type="ST_DisplayName" use="optional"/>
        <xs:attribute name="PublisherDisplayName" type="ST_DisplayName" use="optional"/>
        <xs:attribute name="StoreLogo" type="ST_ImageFile" use="optional"/>
        <xs:attribute name="Square150x150Logo" type="ST_ImageFile" use="optional"/>
        <xs:attribute name="Square44x44Logo" type="ST_ImageFile" use="optional"/>
        <xs:attribute name="Square480x480Logo" type="ST_ImageFile" use="optional"/>
        <xs:attribute name="Description" type="ST_Description" use="optional"/>
        <xs:attribute name="ForegroundText" type="ST_ForegroundText" use="optional"/>
        <xs:attribute name="BackgroundColor" type="ST_Color" use="optional"/>
        <xs:attribute name="SplashScreenImage" type="ST_ImageFile" use="optional"/>
    </xs:complexType>

    <xs:simpleType name="ST_MemoryConfig">
        <xs:restriction base="xs:string">
            <xs:enumeration value="Standard"/>
            <xs:enumeration value="Advanced"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="ST_ConsoleGeneration">
        <xs:restriction base="xs:string">
            <xs:enumeration value="XboxOne"/>
            <xs:enumeration value="Scarlett"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:complexType name="CT_VirtualMachine">
        <xs:all>
            <xs:element name="XboxOneXTitleMemory" type="ST_MemoryConfig" minOccurs="0"/>
            <xs:element name="XboxAnacondaTitleMemory" type="ST_MemoryConfig" minOccurs="0"/>
            <xs:element name="SMTEnabled" type="xs:boolean" minOccurs="0"/>
            <xs:element name="RequiresEraShim" type="xs:boolean" minOccurs="0"/>
            <xs:element name="XboxCompatibility" type="ST_ConsoleGeneration" minOccurs="0"/>
            <xs:element name="DlcCompatibility" type="ST_ConsoleGeneration" minOccurs="0"/>
            <xs:element name="XboxLockhartTitleMemory" type="ST_MemoryConfig" minOccurs="0"/>
        </xs:all>
    </xs:complexType>

    <xs:complexType name="CT_DesktopRegistration">
        <xs:sequence minOccurs="0" maxOccurs="unbounded">
            <xs:element name="ProcessorArchitecture" type="ST_ProcessorArchitecture" minOccurs="0"/>
            <xs:element name="MainPackageDependency " minOccurs="0">
                <xs:complexType>
                    <xs:attribute name="Name" type="ST_PackageName"/>
                </xs:complexType>
            </xs:element>
            <xs:element name="DependencyList" type="CT_DependencyList" minOccurs="0"/>
            <xs:element name="CustomInstallActions" type="CT_CustomInstallActions" minOccurs="0"/>
            <xs:element name="ModFolder" minOccurs="0">
                <xs:complexType>
                    <xs:attribute name="Name" type="ST_FileNameNoPath" use="optional"/>
                </xs:complexType>
            </xs:element>
            <xs:element name="DisableRegistryWriteVirtualization" type="xs:boolean" minOccurs="0"/>
            <xs:element name="DisableFilesystemWriteVirtualization" type="xs:boolean" minOccurs="0"/>
            <xs:element name="EnableWritesToPackageRoot" type="xs:boolean" minOccurs="0"/>
            <xs:element name="MultiplayerProtocol" minOccurs="0">
                <xs:complexType>
                    <xs:simpleContent>
                        <xs:extension base="xs:boolean">
                            <xs:attribute name="Executable" type="ST_Executable"  use="optional"/>
                        </xs:extension>
                    </xs:simpleContent>
                </xs:complexType>
            </xs:element>
            <xs:element name="FileTypeAssociation" type="CT_FileTypeAssociation" minOccurs="0" maxOccurs="100"/>
        </xs:sequence>
    </xs:complexType>

    <xs:simpleType name="ST_KnownDependency">
        <xs:restriction base="xs:string">
            <xs:enumeration value="DX11"/>
            <xs:enumeration value="VC11"/>
            <xs:enumeration value="VC12"/>
            <xs:enumeration value="VC14"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="ST_ProcessorArchitecture">
        <xs:restriction base="xs:string">
            <xs:enumeration value="x64"/>
            <xs:enumeration value="x86"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:complexType name="CT_DependencyList">
        <xs:sequence maxOccurs="128" minOccurs="0">
            <xs:element name="KnownDependency" minOccurs="0">
                <xs:complexType>
                    <xs:attribute name="Name" type="ST_KnownDependency" use="required"/>
                </xs:complexType>
            </xs:element>
            <xs:element name="Dependency" minOccurs="0">
                <xs:complexType>
                    <xs:attribute name="Name" type="ST_PackageName" use="required"/>
                    <xs:attribute name="MinVersion" type="ST_VersionQuad" use="required"/>
                </xs:complexType>
            </xs:element>
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="CT_CustomInstallAction">
        <xs:attribute name="File" type="ST_FileName" use="required"/>
        <xs:attribute name="Name" type="ST_NonEmptyString" use="required"/>
        <xs:attribute name="Arguments" type="ST_NonEmptyString" />
    </xs:complexType>

    <xs:complexType name="CT_InstallActionList">
        <xs:sequence maxOccurs="100" minOccurs="0">
            <xs:element name="InstallAction" type="CT_CustomInstallAction" />
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="CT_RepairActionList">
        <xs:sequence maxOccurs="100" minOccurs="0">
            <xs:element name="RepairAction" type="CT_CustomInstallAction" />
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="CT_UninstallActionList">
        <xs:sequence maxOccurs="100" minOccurs="0">
            <xs:element name="UninstallAction" type="CT_CustomInstallAction" />
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="CT_CustomInstallActions">
        <xs:all>
            <xs:element name="Folder" type="ST_FileName" minOccurs="1"/>
            <xs:element name="InstallActionList" type="CT_InstallActionList" minOccurs="0"/>
            <xs:element name="RepairActionList" type="CT_RepairActionList" minOccurs="0"/>
            <xs:element name="UninstallActionList" type="CT_UninstallActionList" minOccurs="0"/>
        </xs:all>
    </xs:complexType>

    <xs:complexType name="CT_ExecutableList">
        <xs:sequence maxOccurs="unbounded" minOccurs="0">
            <xs:element name="Executable">
                <xs:complexType>
                    <xs:attribute name="Name" type="ST_Executable" use="required"/>
                    <xs:attribute name="TargetDeviceFamily" type="ST_DeviceFamily" use="optional"/>
                    <xs:attribute name="Id" type="ST_ApplicationId" use="optional"/>
                    <xs:attribute name="IsDevOnly" type="xs:boolean" use="optional"/>
                    <xs:attribute name="OverrideDisplayName" type="ST_DisplayName" use="optional"/>
                    <xs:attribute name="OverrideLogo" type="ST_ImageFile" use="optional"/>
                    <xs:attribute name="OverrideSquare480x480Logo" type="ST_ImageFile" use="optional"/>
                    <xs:attribute name="OverrideSquare44x44Logo" type="ST_ImageFile" use="optional"/>
                    <xs:attribute name="OverrideSplashScreenImage" type="ST_ImageFile" use="optional"/>
                    <xs:attribute name="Alias" type="ST_ExecutableNoPath" use="optional"/>
                </xs:complexType>
            </xs:element>
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="CT_AllowedProductsList">
        <xs:sequence maxOccurs="unbounded" minOccurs="0">
            <xs:element name="AllowedProduct" type="ST_StoreId"/>
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="CT_PublisherContent">
        <xs:all>
            <xs:element name="ManifestUrl" type="xs:anyURI" minOccurs="1"/>
        </xs:all>
    </xs:complexType>

    <xs:complexType name="CT_ExtendedAttributeList">
        <xs:sequence maxOccurs="unbounded" minOccurs="0">
            <xs:element name="ExtendedAttribute">
                <xs:complexType>
                    <xs:attribute name="Name" type="ST_NonEmptyString" use="optional"/>
                    <xs:attribute name="Value" type="ST_NonEmptyString" use="optional"/>
                </xs:complexType>
            </xs:element>
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="CT_RelatedProductsList">
        <xs:sequence maxOccurs="unbounded" minOccurs="0">
            <xs:element name="RelatedProduct" type="ST_StoreId"/>
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="CT_MediaCapture">
        <xs:all>
            <xs:element name="GameDVRSystemComponent" type="xs:boolean" minOccurs="0"/>
            <xs:element name="BlockBroadcast" type="xs:boolean" minOccurs="0"/>
            <xs:element name="BlockGameDVR" type="xs:boolean" minOccurs="0"/>
        </xs:all>
    </xs:complexType>

    <xs:simpleType name="ST_AllowedAsciiCharSet">
        <xs:restriction base="ST_NonEmptyString">
            <xs:pattern value="[-_. A-Za-z0-9]+"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="ST_AsciiIdentifier">
        <xs:restriction base="ST_AllowedAsciiCharSet">
            <xs:pattern value="[^_ ]+"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="ST_PackageName">
        <xs:restriction base="ST_AsciiIdentifier">
            <xs:minLength value="3"/>
            <xs:maxLength value="50"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="ST_DistinguishedName">
        <xs:restriction base="ST_NonEmptyString">
            <xs:pattern value="(CN|L|O|OU|E|C|S|STREET|T|G|I|SN|DC|SERIALNUMBER|(OID\.(0|[1-9][0-9]*)(\.(0|[1-9][0-9]*))+))=(([^,+=&quot;&lt;&gt;#;])+|&quot;.*&quot;)(, ((CN|L|O|OU|E|C|S|STREET|T|G|I|SN|DC|SERIALNUMBER|(OID\.(0|[1-9][0-9]*)(\.(0|[1-9][0-9]*))+))=(([^,+=&quot;&lt;&gt;#;])+|&quot;.*&quot;)))*"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="ST_Publisher">
        <xs:restriction base="ST_DistinguishedName">
            <xs:maxLength value="8192"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="ST_ResourceId">
        <xs:restriction base="ST_AsciiIdentifier">
            <xs:maxLength value="30"/>
        </xs:restriction>
  </xs:simpleType>

    <xs:simpleType name="ST_Port">
        <xs:restriction base="ST_NonEmptyString">
            <xs:pattern value="[1-9][0-9]{0,4}"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:complexType name="CT_DebugNetworkPortList">
        <xs:sequence maxOccurs="unbounded" minOccurs="0">
            <xs:element name="DebugNetworkPort" type="ST_Port"/>
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="CT_DevelopmentOnly">
      <xs:all>
        <xs:element name="ContentIdOverride" type="ST_GUID" minOccurs="0"/>
        <xs:element name="EKBIDOverride" type="ST_GUID" minOccurs="0"/>
        <xs:element name="DebugNetworkPortList" type="CT_DebugNetworkPortList" minOccurs="0"/>
      </xs:all>
    </xs:complexType>

    <xs:simpleType name="ST_FTAInfoTip">
        <xs:restriction base="ST_NonEmptyString">
            <xs:maxLength value="1024"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="ST_ContentTypeCharSet">
        <xs:restriction base="ST_NonEmptyString">
            <xs:pattern value="[!#$%&amp;'*+-.^_`|~0-9a-z/]*"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="ST_ContentType">
        <xs:restriction base="ST_ContentTypeCharSet">
            <xs:pattern value="[^/]{1,127}/[^/]{1,127}"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="ST_FileType">
        <xs:restriction base="ST_FileNameCharSet">
            <xs:pattern value="\.[^.\\]+"/>
            <xs:maxLength value="64"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:complexType name="CT_FTASupportedFileTypes">
        <xs:sequence>
            <xs:element name="FileType" maxOccurs="1000" >
                <xs:complexType>
                    <xs:simpleContent>
                        <xs:extension base="ST_FileType">
                            <xs:attribute name="ContentType" type="ST_ContentType" use="optional"/>
                        </xs:extension>
                    </xs:simpleContent>
                </xs:complexType>
            </xs:element>
        </xs:sequence>
    </xs:complexType>

    <xs:simpleType name="ST_FTAName">
        <xs:restriction base="ST_AllowedAsciiCharSet">
            <xs:pattern value="[^ A-Z]+"/>
            <xs:maxLength value="100"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:complexType name="CT_FileTypeAssociation">
        <xs:all>
            <xs:element name="DisplayName" type="ST_DisplayName" minOccurs="0"/>
            <xs:element name="Logo" type="ST_ImageFile" minOccurs="0"/>
            <xs:element name="InfoTip" type="ST_FTAInfoTip" minOccurs="0"/>
            <xs:element name="EditFlags" minOccurs="0">
                <xs:complexType>
                    <xs:attribute name="OpenIsSafe" type="xs:boolean" use="optional"/>
                    <xs:attribute name="AlwaysUnsafe" type="xs:boolean" use="optional"/>
                </xs:complexType>
            </xs:element>
            <xs:element name="SupportedFileTypes" type="CT_FTASupportedFileTypes"/>
        </xs:all>
        <xs:attribute name="Name" type="ST_FTAName" use="required"/>
        <xs:attribute name="Executable" type="ST_Executable"  use="optional"/>
    </xs:complexType>

    <xs:simpleType name="ST_GameSaveNoCodePcRootRelativeLocation">
        <xs:restriction base="xs:string">
            <xs:enumeration value="AppData"/>
            <xs:enumeration value="Public"/>
            <xs:enumeration value="LocalAppData"/>
            <xs:enumeration value="LocalAppDataLow"/>
            <xs:enumeration value="ProgramData"/>
            <xs:enumeration value="SavedGames"/>
            <xs:enumeration value="UserProfile"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="ST_GameSaveUserQuotaSize">
        <xs:restriction base="xs:integer">
            <xs:maxInclusive value="4096"/>
            <xs:minInclusive value="256"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:complexType name="CT_SaveGameStorage">
        <xs:all>
            <xs:element name="NoCodePCRoot" minOccurs="0">
                <xs:complexType>
                    <xs:simpleContent>
                        <xs:extension base="ST_FileName">
                            <xs:attribute name="RelativeTo" type="ST_GameSaveNoCodePcRootRelativeLocation" use="required"/>
                        </xs:extension>
                    </xs:simpleContent>
                </xs:complexType>
            </xs:element>
            <xs:element name="SCID" type="ST_GUID" minOccurs="0"/>
            <xs:element name="MaxUserQuota" type="ST_GameSaveUserQuotaSize" minOccurs="0"/>
        </xs:all>
    </xs:complexType>

    <!-- Root -->
    <xs:element name="Game">
        <xs:complexType>
            <xs:all>
                <xs:element name="Identity" type="CT_Identity" />
                <xs:element name="ShellVisuals" type="CT_ShellVisuals" minOccurs="0"/>
                <xs:element name="Resources" type="CT_Resources" minOccurs="0"/>
                <xs:element name="ExecutableList" type="CT_ExecutableList" minOccurs="0"/>
                <xs:element name="GameOsVersion" type="ST_VersionQuad" minOccurs="0"/>
                <xs:element name="MediaCapture" type="CT_MediaCapture" minOccurs="0"/>
                <xs:element name="StoreId" type="ST_StoreId" minOccurs="0" />
                <xs:element name="TargetDeviceFamilyForDLC" type="ST_DeviceFamily" minOccurs="0"/>
                <xs:element name="AllowedProducts" type="CT_AllowedProductsList" minOccurs="0"/>
                <xs:element name="RelatedProducts" type="CT_RelatedProductsList" minOccurs="0"/>
                <xs:element name="PersistentLocalStorage" type="CT_PersistentLocalStorage" minOccurs="0"/>
                <xs:element name="VirtualMachine" type="CT_VirtualMachine" minOccurs="0"/>
                <xs:element name="MSAFullTrust" type="xs:boolean" minOccurs="0"/>
                <xs:element name="MSAAppId" type="ST_NonEmptyString" minOccurs="0"/>
                <xs:element name="TitleId" type="ST_Hex8" minOccurs="0"/>
                <xs:element name="RequiresXboxLive" type="xs:boolean" minOccurs="0"/>
                <xs:element name="ExtendedAttributeList" type="CT_ExtendedAttributeList" minOccurs="0"/>
                <xs:element name="DesktopRegistration" type="CT_DesktopRegistration" minOccurs="0"/>
                <xs:element name="DevelopmentOnly" type="CT_DevelopmentOnly" minOccurs="0"/>
                <xs:element name="AdvancedUserModel" type="xs:boolean" default="true" minOccurs="0" maxOccurs="1" />
                <xs:element name="SaveGameStorage" type="CT_SaveGameStorage" minOccurs="0"/>
                <xs:element name="PublisherContentBaseProduct" type="ST_StoreId" minOccurs="0" maxOccurs="1"/>
                <xs:element name="PublisherContent" type="CT_PublisherContent" minOccurs="0" maxOccurs="1"/>
            </xs:all>
            <xs:attribute name="configVersion" use="required">
                <xs:simpleType>
                    <xs:restriction base="xs:integer">
                        <xs:maxInclusive value="1"/>
                    </xs:restriction>
                </xs:simpleType>
            </xs:attribute>
        </xs:complexType>
        <xs:unique name="Resource_Language">
            <xs:selector xpath="Resources/Resource"/>
            <xs:field xpath="@Language"/>
        </xs:unique>
    </xs:element>
</xs:schema>
```

[返回本文顶部。](/zh-CN/reference/system/microsoftgameconfig/microsoftgameconfig-schema)

## 以前的元素参考

* PrimaryServiceConfig 曾是 XBOX One ERA AppxManifest.xml 中用于定义 SCID 调用的元素。现在已在代码中定义并在 DevCenter 中配置。
* VisualElements 曾是 XBOX One ERA AppxManifest.xml 中用于定义 Store 徽标和游戏其他视觉方面的元素。现在在 ShellVisuals 中定义。
* GpuAvailability 曾是 XBOX One ERA AppxManifest.xml 中用于定义 GPU 可用性的元素。现在所有 Microsoft Game Development Kit (GDK) 游戏都自动获得可变设置（尽可能多的 GPU），因此会自动完成此操作。
* ConnectedStorageQuota 曾是 XBOX One ERA AppxManifest.xml 中用于定义已连接存储大小的元素。现在由服务器端设置决定。
* LicenseOverrides 曾是 XBOX One ERA debug\_licensing\_overrides.xml 中用于定义 ContentID、ProductID 和 EKBID 覆盖的元素。现在直接在 MicrosoftGame.config 中通过 ContentIDOverride、StoreId 和 EKBIDOverride 元素进行管理。
* NetworkManifest 元素以前在 MicrosoftGame.config 的先前版本中定义。除了 DebugNetworkPortList 元素外，现在都通过现有的网络 API 完成。
* XboxOneTitleMemoryMaxMB 和 XboxOneXTitleMemoryMaxMB 曾是先前版本 MicrosoftGame.config 中使用的元素。XboxOneTitleMemoryMaxMB 不再可配置，用于 XBOX One X 和 XBOX Series S|X 的 Title Memory 配置元素现在是 XboxOneXTitleMemory、XboxLockhartTitleMemory 和 XboxAnacondaTitleMemory。
* packageWriteRedirectionCompatibilityShim 以前是一个 ExtendedAttribute 值，用于在 2020 年 5 月 GDK 之前启用此功能。自 2020 年 5 月 GDK 起，此值现在作为其自身的元素 EnableWritesToPackageRoot 进行跟踪。

[返回本文顶部。](/zh-CN/reference/system/microsoftgameconfig/microsoftgameconfig-schema)

## 受限功能配置

在 Microsoft Game Development Kit (GDK) 中，受限功能通过 MicrosoftGame.config 元素进行配置。常用功能的映射如下。

* runFullTrust 功能默认已配置为启用。
* customInstallActions 功能由 CustomInstallActions 元素配置。

受限功能需要通过电子邮件联系你的客户经理，以确保为其启用相关权限（这是除了正确更新 MicrosoftGame.config 之外还需要的）。有关这些功能以及如何配置 MicrosoftGame.config 以在 PC 游戏中使用它们的详细信息，请参阅 [PC 打包入门](/zh-CN/build/core-features/common/packaging/overviews/packaging-getting-started-for-PC)。

## 作为 DLC 包创建一部分的 MicrosoftGame.config

有关如何为 DLC 包生成 MicrosoftGame.config 的详细信息，请参阅[可下载内容 (DLC) 包](/zh-CN/build/core-features/common/packaging/packaging-downloadable-content-dlc)。

[返回本文顶部。](/zh-CN/reference/system/microsoftgameconfig/microsoftgameconfig-schema)

## 另请参阅

[MicrosoftGame.config 元素参考](/zh-CN/reference/system/microsoftgameconfig/elements/gc-microsoftgameconfig-toc)\
[MicrosoftGame.Config](/zh-CN/build/core-features/common/game-config/MicrosoftGameConfig-toc)\
[MicrosoftGame.Config 概览](/zh-CN/build/core-features/common/game-config/MicrosoftGameConfig-Overview)\
[MicrosoftGame.Config 本地化](/zh-CN/build/core-features/common/game-config/MicrosoftGameConfig-Localization)\
[打包概览](/zh-CN/build/core-features/common/packaging/overviews/packaging)\
[PC Bootstrapper](/zh-CN/build/gdk-and-engines/guides/pc-bootstrapper)


## Related topics

- [MicrosoftGame.config 元素参考（内容）](/zh-CN/reference/system/microsoftgameconfig/elements/gc-microsoftgameconfig-toc.md)
- [FileTypeAssociation 元素 (MicrosoftGame.config)](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-filetypeassociation.md)
- [MicrosoftGame.config 编辑器与参考](/zh-CN/build/core-features/common/game-config/index.md)
- [AllowedProducts 元素参考 (MicrosoftGame.config)](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-allowedproduct.md)
- [Game 元素 (MicrosoftGame.config)](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-game.md)
