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

# 升级

> 检查是否有更新的 CLI 稳定版本,并获取手动更新的说明。

`xbox upgrade` 会在 GitHub 上检查是否有更新的稳定版本,如果有,则告诉你如何安装它。它不会下载或安装任何内容,并且你无需登录。

```bash theme={null}
xbox upgrade
```

## 选项

| 选项 | 说明 |
| - | - |
| `--check` | 检查是否有更新的版本。这是默认行为,因此 `xbox upgrade` 和 `xbox upgrade --check` 的作用相同。 |
| `--output <format>` | `json`(默认)或 `json-compact`。`table` 不可用。 |

`--confirm` (`--yes`, `-y`) 会被拒绝,因为不会安装任何内容。

## 结果

成功的检查会向 stdout 写入一个 JSON 对象:

| 字段 | 说明 |
| - | - |
| `schemaVersion` | `1`。 |
| `currentVersion` | 正在运行的版本,与 `xbox --version` 显示的版本相同。 |
| `latestVersion` | 最新的稳定版本,不带前导 `v`。 |
| `updateAvailable` | 当最新的稳定版本比正在运行的版本更新时为 `true`。 |
| `releaseNotesUrl` | 该版本在 GitHub 上的页面。 |
| `message` | 供人员阅读的摘要。 |
| `instructions` | 当 `updateAvailable` 为 `true` 时说明如何更新;否则为空数组。 |

```bash theme={null}
xbox upgrade --output json-compact
```

```json theme={null}
{"schemaVersion":1,"currentVersion":"1.2.0","latestVersion":"1.3.0","updateAvailable":true,"releaseNotesUrl":"https://github.com/xbox/cli/releases/tag/v1.3.0","message":"A newer stable XBOX CLI release is available. Update manually using the instructions below.","instructions":["..."]}
```

若要安装更新,请参阅[更新 ZIP 安装](https://docs.xbox.com/zh-CN/tools/xbox-cli/installation.md#update-a-zip-installation);
对于 WinGet,请参阅 [Windows:使用 WinGet 安装](https://docs.xbox.com/zh-CN/tools/xbox-cli/installation.md#windows-install-with-winget)。版本可能会在 GitHub 上发布几个小时后才会出现在 WinGet 中,因此 `winget upgrade` 可能尚未提供该版本。

## 退出代码

| 退出代码 | 含义 |
| - | - |
| `0` | 检查已成功,无论是否有可用的更新。请读取 `updateAvailable`。 |
| `1` | 检查失败,stdout 为空。 |

检查不会登录到 GitHub。HTTP 404 表示未找到公开的稳定版本,HTTP 403 或 429 表示 GitHub 拒绝了请求或对请求进行了速率限制。在这两种情况下,请改为在浏览器中打开
[版本页面](https://github.com/xbox/cli/releases)。


## Related topics

- [账户升级](https://docs.xbox.com/zh-CN/services/playfab/pricing/account-upgrades.md)
- [Entity API 重构升级教程](https://docs.xbox.com/zh-CN/services/playfab/live-service-management/game-configuration/entities/entity-api-restructure-upgrade-tutorial.md)
- [PlayFab 支持](https://docs.xbox.com/zh-CN/services/playfab/pricing/support.md)
- [Visual Studio 2019 GDK 支持说明](https://docs.xbox.com/zh-CN/tools/tools-console/visualstudio/vs-2019-support-notes.md)
- [Visual Studio 2019 支持说明](https://docs.xbox.com/zh-CN/tools/tools-pc/visualstudio/gr-vs-2019-support-notes.md)
