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

# TitleId 元素 (MicrosoftGame.config)

> MicrosoftGame.config 元素 - TitleId

# MicrosoftGame.config 元素 - TitleId

指定该游戏的 XBOX Live Title ID，用于在 XBOX Live 服务中作为身份标识。自 2022 年 3 月 GDK 起，如果指定了 MSAAppId 元素，则新游戏必须提供 Title Id。此要求由 MicrosoftGame.config 架构版本更新（从 configVersion 0 到 configVersion 1）强制执行，仅适用于使用 2022 年 3 月 GDK 及更高版本创建的新游戏。

## 父元素

此元素的父元素为 Game 元素。

## 要求

此元素为可选项，不要求必须设置。
如果 MicrosoftGame.config 中 configVersion = 1，则在以下情况下必须设置此元素：

* 指定了 MSAAppId 元素。
* 指定了 NoCodePCRoot 元素。
* AdvancedUserModel 元素被设置为 false。

## 平台

此元素适用于 PC 和主机。

## 行为

* 无属性。
* 无默认值。
* 允许值为 8 个十六进制字符。

## 备注

* TitleId 元素是从 Partner Center 生成的游戏标识。可在 Partner Center 项目的 [Game Setup -> Identity 详细信息](https://docs.xbox.com/zh-CN/services/xbox-services/fundamentals/portal-config/live-setup-partner-center-partners.md)中找到。
* MicrosoftGame.config 中的 TitleId 元素必须与 Partner Center 中的值匹配。[MicrosoftGame.config 编辑器](https://docs.xbox.com/zh-CN/build/core-features/common/game-config/MicrosoftGameConfig-Editor.md)提供了一个名为 Store Association Wizard 的工具，可自动将本地 .config 中的 TitleId（以及其他 ID 值）与 Partner Center 中该产品的现有值同步。
* Visual Studio 新建项目模板会为此元素提供默认值 'FFFFFFFF'。此值允许早期迭代阶段编译游戏，而不必立即从 Partner Center 获取 ID。强烈建议一旦游戏能够构建，就立即更改此 ID，以避免尝试进行 API 调用时出现失败。

## 另请参阅

[MicrosoftGame.config 参考 - 目录](https://docs.xbox.com/zh-CN/reference/system/microsoftgameconfig/elements/gc-microsoftgameconfig-toc.md)


## Related topics

- [MicrosoftGame.config 元素参考（内容）](https://docs.xbox.com/zh-CN/reference/system/microsoftgameconfig/elements/gc-microsoftgameconfig-toc.md)
- [错误代码](https://docs.xbox.com/zh-CN/reference/errorcodes.md)
- [MSAAppId 元素 (MicrosoftGame.config)](https://docs.xbox.com/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-msaappid.md)
- [AdvancedUserModel 元素 (MicrosoftGame.config)](https://docs.xbox.com/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-advancedusermodel.md)
- [NoCodePCRoot 元素 (MicrosoftGame.config)](https://docs.xbox.com/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-nocodepcroot.md)
