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

# Submission Validator 质量检查

> Submission Validator 质量检查

Submission Validator 识别的问题类型会随时间不断增加和演进。目标是让游戏从提交、认证到进入市场之路更顺畅。

Submission Validator 运行以下质量检查:

* [可用版本](#ID4EY)
* [已批准的 GDK 版本](#ID4AGDK)
* [已批准的 Game OS](#ID4EKB)
* [内容(可下载内容(DLC))的最终区块中的启动标记](#ID4EHD)
* [多余的 Resources.pri 文件](#ID4EDE)
* [缺少 Resources.pri 文件](#ID4ERF)
* [每个包只能有一个应用](#ID4EBBAC)
* [最大包大小](#ID4E3BAC)
* [外来文件](#ID4EDCAC)
* [二进制扫描](#ID4EEEAC)
* [Microsoft (MS) 组件版本](#ID4ESFAC)
* [缺少依赖文件](#ID4MDF)
* [ARM64 二进制文件](#IDDKDF)

<a id="ID4EY" />

## 可用版本

Submission Validator 会检查你安装的版本是否为最新且正确版本。如果不是,Submission Validator 输出日志会显示失败。以下部分中所示的失败消息包含用于下载正确版本的链接。

```xml theme={null}
<component>Available Version Check</component>
<failure>A required update to Submission Validator is available. The latest version can be downloaded from https://aka.ms/currentsubvalzip. Download and install the update, then rebuild the package. Contact your 
Developer Account Manager for assistance.</failure> 
```

<a id="ID4AGDK" />

## 已批准的 GDK 版本

当你为 PC 创建 GDK 包(msixvc)时,Submission Validator 会检查你用于打包的 GDK 是否为已批准的 GDK 版本。如果版本不在已批准或已弃用列表中,验证器日志会显示失败。

```xml theme={null}
<failure>ILI_PcGdkUnsupportedThe GDK used to compile your binaries is not supported. Use only supported GDK versions according to the Approved Libraries page located at https://aka.ms/GdkApprovedLibs</failure>
```

如果版本在已弃用列表中,验证器日志会显示信息性消息。此消息表示该版本已过期,不再接收修补程序。

```xml theme={null}
<info>The GDK used to compile your binaries is expired and will no longer receive hotfixes.</info>
```

如果 Submission Validator 无法从包中包含的文件中确定 GDK 版本 —— 例如,因为这些文件被加密 —— 它会显示以下消息。

```xml theme={null}
<info>A GDK version was not able to be extracted from your game executable. The version of the tools used for packaging will be used as the GDK version for this submission. If this is not correct, ensure any executables listed in your MicrosoftGame.config include XGameRuntime.h or you include appropriate middleware which consumes this header. See https://aka.ms/EmbeddedGdkVersion for more information.</info>
```

<a id="EmbeddedGdkVersion" />

### GDK 版本如何嵌入游戏可执行文件中

当你使用包含 `XGameRuntime.h` 的 GDK 编译游戏可执行文件时,编译器会将 GDK 版本嵌入到一个名为 `.xbld` 的自定义 PE 段中。Submission Validator 会读取此段以确定用于构建游戏二进制文件的 GDK 版本。

如果 `.xbld` 段缺失或不可读,Submission Validator 会回退到使用打包工具的版本作为此次提交的 GDK 版本。此版本可能无法准确表示用于编译你的二进制文件所使用的 GDK 版本。

**常见原因:反篡改软件**

处理你可执行文件的反篡改和数据加密工具可能会加密或移除 `.xbld` 段。此操作使 Submission Validator 无法读取该段。要解决此问题,请配置你的反篡改工具,以将 `.xbld` 段排除在处理之外。

#### Themida

在你的 Themida 配置文件中添加以下 **Advanced Option**(以逗号分隔),以将 `.xbld` 段排除在保护之外:

```
OPTION_ADVANCED_DONT_PROCESS_SECTIONS=.xbld
```

#### GuardIT

要将 `.xbld` 段排除在 GuardIT 的数据加密之外,请向你的加密守护(guard)配置添加一个 `<exclude>` 条目:

```xml theme={null}
<guard_cmd name="EncryptionWrapper">
    <encryption_wrapper>
        <action>
            <fail />
        </action>
        <algorithm_decryption>
            <use>AES128</use>
        </algorithm_decryption>
        <algorithm_integrity>
            <use>fast</use>
        </algorithm_integrity>
        <protected_types>
            <custom>
                <data>true</data>
                <native_code>true</native_code>
                <unused_areas>true</unused_areas>
            </custom>
        </protected_types>
        <exclude>
            <range>
                <section matching="exact">.xbld</section>
            </range>
        </exclude>
        <debug>false</debug>
        <disable>false</disable>
    </encryption_wrapper>
</guard_cmd>
```

`<exclude>` 部分可防止 `.xbld` 被加密。

<a id="ID4EKB" />

## 已批准的 Game OS

Submission Validator 会检查 Game OS 和来自 Microsoft 游戏开发工具包(GDK)的任何可选组件是否来自同一版本的 Microsoft 游戏开发工具包(GDK),以及它们是否为可用于已发布游戏的已批准版本。如果版本不在已批准或已弃用列表中,验证器日志会包含失败,如下所示。

```xml theme={null}
<failure>The GameOS included in this package is not an approved version. Use only 
supported GameOS versions according to the Approved Libraries page on the Developer 
Network Portal</failure>  
```

如果版本在已弃用列表中,验证器日志会包含信息性消息。此消息表示该版本已过期,不再接收修补程序,如下所示。

```xml theme={null}
<info>The GameOS included in this package is expired and will no longer receive hotfixes.</info>  
```

如果各组件的版本互不匹配,或者版本不在已批准或已弃用列表中,验证器日志会包含失败,如下所示。

```xml theme={null}
<failure>The GameOS version does not match the version of other Microsoft components 
included in this package. Use only components from the same Microsoft Game Development Kit (GDK)/Xbox One Software Development Kit release. Refer to the 
Approved Libraries page on the Developer Network Portal</failure>  
```

<Note>如果运行 Submission Validator 的开发 PC 无法访问在线信息,则可能无法完成其验证检查。例如,它没有互联网访问权限、被防火墙阻止,或没有网络连接。</Note>

<a id="ID4EHD" />

## 内容(可下载内容(DLC))的最终区块中的启动标记

为了确保在所有场景下正常运行,内容包必须使用启动标记(launch marker)属性标记最终区块。如果最终区块未包含启动标记,包可能被正确测试,但在某些情况下会给终端用户带来问题。失败消息如下所示。

```xml theme={null}
<failure>Content Packages require final layout chunk to include attribute marker="Launch"</failure>  
```

<a id="ID4EWD" />

<a id="ID4EDE" />

## 多余的 Resources.pri 文件

Submission Validator 会检查布局的其他目录中是否不存在额外的 *Resources.pri* 文件。与 *MicrosoftGame.config* 一样,只使用根目录中的那个。然而,拥有多个副本可能会造成关于哪个是正确的以及开发者对这些其他文件的意图的困惑。

此检查类似于对 MicrosoftGame.config 额外副本的类似检查。在这种情况下,额外副本会在日志的“外来文件检查”部分导致失败,如下所示。

```xml theme={null}
<failure>D:\path\mytitle\mytitlesubdirectory\resources.pri</failure>  
```

<a id="ID4ERF" />

## 缺少 Resources.pri 文件

应用不必被本地化。然而,如果应用在根目录(与 MicrosoftGame.config 相同的位置)中未包含 *Resources.pri* 文件,输出日志的“外来文件检查”部分会出现以下警告。

```xml theme={null}
<warning>Non-localized app: 'resources.pri' is missing</warning>  
```

<a id="ID4EBBAC" />

## 每个包只能有一个应用

Submission Validator 现在会验证每个包中仅包含一个非 DevOnly 应用。

<a id="ID4E3BAC" />

## 最大包大小

当你以光盘发布时,Submission Validator 会检查包大小是否超过 49,900,000,000 字节。此检查仅提供信息性消息,并非错误。

当你不以光盘发布时,Submission Validator 会检查包大小是否超过 500 GB。当包大小超过 450 GB 时,还会提供警告消息。消息如下:

```xml theme={null}
(WARNING) ILI_XvcPackageSizeApproached: "The size of this package is approaching the maximum allowed size for uploading to Partner Center. The maximum size of a package for uploading to Partner Center is {0} GB."
```

```xml theme={null}
(FAILURE) ILI_XvcPackageSizeExceeded: "The size of this package exceeds the maximum allowed size for uploading to Partner Center. The maximum size of a package for uploading to Partner Center is {0} GB."
```

<a id="ID4EDCAC" />

## 外来文件

在审查 XBOX 360 项目的提交时遇到的一个问题是,提交中包含了各种通常是意外包含的、本不该作为零售游戏一部分的文件。

外来文件检查(Foreign File Check)使用 layout .xml 文件检查带入游戏包的所有文件,查找不允许出现在包中的特定文件名和扩展名。此检查仅基于文件名,而不是文件内容。不允许的文件包括与源代码和调试文件相关的扩展名、Thumb.db、根目录之外的多余注册文件,以及不能出现在游戏包中的 XBOX 操作系统文件的完整列表。此检查验证 XBOX Requirement XR-003:Title Quality for Submission。

下表显示了在提交的游戏包中不允许的文件类型和扩展名。

| 文件类型      | 扩展名                      |
| --------- | ------------------------ |
| 与源代码相关的文件 | .c .cpp、.cs、.lib、.h、.obj |
| 调试/符号信息文件 | .pdb、.sym                |
| 旧版二进制文件   | .xbe                     |

游戏可能会合法地使用几乎任何可想到的文件扩展名,这可能会与扩展名检查冲突。如果这种情况影响到你的游戏,请通知你的合作伙伴开发经理(PDM)。

如果你认为有特殊情况需要在游戏包中包含某个文件,但 Submission Validator 日志中出现了失败消息,请咨询你的 PDM。

以下示例显示了外来文件检查中报告失败的日志输出。

```xml theme={null}
<component>Foreign File Check</component>
<failures>
  <failure>c:\MyTitle\loose\bar.cpp</failure>
  <failure>c:\MyTitle\loose\MySubDir\example.h</failure>
  <failure>c:\MyTitle\loose\MySubDir\PDBs\BlockedFiles\foo.pdb</failure>
</failures>
<filecount>3</filecount>  
```

<a id="ID4EEEAC" />

## 二进制扫描

XBOX 主机二进制文件(.exe 和 .dll)必须为 AMD64 构建,且只能是原生代码。目前平台不支持托管代码二进制文件。二进制扫描检查(Binary Scan Check)会检查你包含在游戏包中的每个 .exe 和 .dll 文件,并确保它满足这些要求。使用此检查验证 XR-003:Title Quality for Submission。

在二进制扫描部分,系统会检查每个 .exe 和 .dll 文件是否依赖了因安全原因在零售主机上被禁止的组件。通常,这种阻止表现为链接到平台文件的调试版本、PIXEvt.dll 或 XBOX Studio。

以下示例显示了二进制扫描检查中报告失败的日志输出。前两处失败源自一个 .exe 文件链接到两个不允许用于零售主机的文件。第三处失败是一个托管的 .exe 文件。最后一处失败是一个非 AMD64 的原生代码 .dll 文件。

```xml theme={null}
<component>Binary Scan</component>
      <dumpbinlocation>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64\dumpbin.exe</dumpbinlocation>
      <failures>
   <failure>Non-retail dependency in file c:\MyTitle\loose\ExeWithDebugDependencies.exe: MSVCR110D.dll</failure>
  <failure>Non-retail dependency in file c:\MyTitle\loose\ExeWithDebugDependencies.exe: PIXEvt.dll</failure>
  </failures>
  <failure>Managed: Not AMD64: c:\MyTitle\loose\MySubDir\ABC.exe</failure>
  <failure>Not AMD64: c:\MyTitle\loose\MySubDir\XYZ.dll</failure>
</failures>  
```

开发者应确保将此类以调试为目的的依赖项从要包含在提交包中的二进制文件的发布版本中排除。

<a id="ID4ESFAC" />

## Microsoft 组件版本

Game OS 覆盖了 XBOX 平台面向应用的大部分内容。然而,游戏会再分发一组由 Microsoft 提供的二进制文件。XBOX Developer Forums 站点上的 [Approved Libraries](https://aka.ms/GdkApprovedLibs) 页面列出了这些文件及其已批准的版本。

Submission Validator 会检查这些文件的版本,以确保任何可选 DLL 文件均为匹配版本。它还会捕获独占分区游戏打包到 XVC 中的 Game OS 的版本 ID。在提交之前,请对照已发布的批准库信息检查版本。

如果你的游戏包含可选的 Kinect 和 XBOX Services DLL 文件,Submission Validator 也会提取其版本信息。

以下示例显示了 Submission Validator 日志文件中出现的版本信息。

```xml theme={null}
<component>MS Component Versions</component>
<component name="GameOS">60BBA05C-22F0-4452-84B6-DD278594716E</component>
<component name="Microsoft.Xbox.Services.dll">10.0.18362.7198</component>  
```

<a id="ID4MDF" />

## 缺少依赖文件

当你动态链接依赖库时,如果这些库缺失,Submission Validator 会包含以下失败:

```xml theme={null}
<failure>{0}: Binary file has a dependency on a file that is not included in the layout: {1}. This file must be included in the layout for your package.</failure>
```

<a id="IDDKDF" />

## ARM64 二进制文件

你可以在 PC 的游戏包中,与现有的 x64 编译可执行文件一同包含 ARM64 二进制文件。Submission Validator 会检查 MicrosoftGame.config 是否正确引用了相应的可执行文件。

```xml theme={null}
<failure>Executable with the Architecture attribute set to ARM64 is not compiled for the ARM64 platform. Please ensure the attributes are set correctly for this executable in your MicrosoftGame.config file.</failure>
```

```xml theme={null}
<failure>Executable is compiled for the ARM64 platform but does not have the Architecture attribute set to ARM64. Please ensure the attributes are set correctly for this executable in your MicrosoftGame.config file.</failure>
```

<a id="ID4E5OAC" />

## 另请参见

[Submission Validator (SubmissionValidator.dll)](/build/core-features/common/packaging/subval/submissionvalidator)

[Submission Validator 消息](/build/core-features/common/packaging/subval/submissionvalidator-messages)

[Make package (makepkg.exe)](/build/core-features/common/packaging/deployment/makepkg)

[游戏打包、内容更新和流式安装测试](/build/core-features/common/packaging/title-packaging-streaming-install-testing)

XBOX Requirements (XRs) [(XBOX Developer Downloads->Partner, Publishing, and Release Management Information->XGD Partner Documentation)](https://aka.ms/xgddl)


## Related topics

- [Submission Validator (SubmissionValidator.dll)](/zh-CN/build/core-features/common/packaging/subval/submissionvalidator.md)
- [Submission Validator 消息](/zh-CN/build/core-features/common/packaging/subval/submissionvalidator-messages.md)
- [Submission Validator (SubVal) 质量检查参考](/zh-CN/build/core-features/common/packaging/subval/index.md)
- [检查匹配的服务质量(流程图)](/zh-CN/services/xbox-services/multiplayer/mpm/concepts/flowcharts/live-mpm-use-matchmaking-and-qos.md)
- [游戏打包、更新与流式安装测试](/zh-CN/build/core-features/common/packaging/title-packaging-streaming-install-testing.md)
