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

# 在不安装 Microsoft Game Development Kit (GDK) 的情况下使用工具

> 介绍在不安装 Microsoft Game Development Kit (GDK) 的情况下使用工具的过程。

本主题介绍从提取位置使用 Microsoft Game Development Kit (GDK) 工具所需的步骤。如最初的提取文档中所述，这主要侧重于支持构建场景。不保证所有工具的所有操作都受支持。

## 命令提示符和命令行构建

大多数命令提示符操作预计都能正常工作。使用已配置为运行覆盖后环境变量的命令提示符，可以最大程度地确保这一点。

有关如何配置构建环境和命令提示符的更多详细信息，请参阅[在不安装 Microsoft Game Development Kit 的情况下配置构建环境](https://learn.microsoft.com/en-us/gaming/gdk/docs/gdk-dev/console-dev/usingwithoutinstall/build-environment-withoutinstall)。

配置完成后，通过 MSBuild 执行的构建会使用覆盖后的环境变量指向提取的文件位置。

## XbtpLinkSvc 设置

XBOX 传输协议服务（[XbtpLinkSvc（NDA 主题）](https://learn.microsoft.com/en-us/gaming/gdk/docs/tools/tools-console/commandlinetools/xbtplinksvc)）负责协调开发 PC 与开发主机之间的快速数据传输。

需要注册并启动 XbtpLinkSvc，才能从提取位置实现预期的部署行为。为此，请从 Microsoft GDK\bin 目录运行以下命令。

```cmd theme={null}
XbtpLinkSvc.exe /register /f 
XbtpLinkSvc.exe /routing
```

**/register** 命令用于配置该服务以供使用。**/routing** 命令用于启动该服务。

### 防火墙设置

你可能会遇到防火墙通知，提示 XbtpLinkSvc.exe 正在 TCP 端口 4201 上接受来自主机的传入连接。允许 XbtpLinkSvc.exe 接受传入连接可以提供更好的体验。如果网络策略限制了到 XbtpLinkSvc.exe 的传入连接，则需要针对每台主机经常执行 **xbconnect /data**，以确保已建立由 PC 发起的到主机的连接。允许这些传入连接后，主机便能按需发起到 PC 的连接。

可以在提升权限的命令提示符中使用以下命令，将名为 "XBOX Transport Link Service (inbound)" 的合适防火墙规则添加到 Windows 防火墙：

```cmd theme={null}
netsh advfirewall firewall add rule name="Xbox Transport Link Service (inbound)" dir=in action=allow protocol=tcp localport=4201
```

### 添加 Windows Defender 排除项

默认情况下，Windows Defender 可能会终止由 XbtpLinkSvc 建立的部署连接。Microsoft Game Development Kit (GDK) 安装程序包含一个添加 Windows Defender 排除项的步骤，以防止出现这种情况。

你可以使用 PowerShell 命令 [Add-MpPreference](https://learn.microsoft.com/powershell/module/defender/add-mppreference?view=windowsserver2022-ps) 手动添加此排除项：

```powershell theme={null}
Add-MpPreference -ExclusionProcess "xbtplinksvc.exe"
```

要删除此排除项，请使用 PowerShell 命令 [Remove-MpPreference](https://learn.microsoft.com/powershell/module/defender/remove-mppreference?view=windowsserver2022-ps)：

```powershell theme={null}
Remove-MpPreference -ExclusionProcess "xbtplinksvc.exe"
```

### 更改提取目录

如果 Microsoft Game Development Kit (GDK) 的位置发生变化，则需要重新注册 XbtpLinkSvc、终止该任务并重新启动。为此，请从（新的 Microsoft Game Development Kit (GDK) 位置的）Microsoft GDK\bin 目录运行以下命令。

```cmd theme={null}
XbtpLinkSvc.exe /register /f  
taskkill /im XbtpLinkSvc.exe /f  
XbtpLinkSvc.exe /routing
```

这样即可在新的提取位置正确重新启动该服务。

## 另请参阅

[在不安装的情况下使用 Microsoft Game Development Kit](https://docs.xbox.com/zh-CN/build/console-features/build-without-install/gc-usingwithoutinstall-toc.md)

[使用 Microsoft Game Development Kit 配置、构建和部署 XBOX 项目（NDA 主题）](https://learn.microsoft.com/en-us/gaming/gdk/docs/archive/gc-usinggsdk-toc)


## Related topics

- [在不安装的情况下使用 Microsoft Game Development Kit（目录）](https://docs.xbox.com/zh-CN/build/console-features/build-without-install/gc-usingwithoutinstall-toc.md)
- [使用 Microsoft Game Development Kit (GDK) 工具安装并启动 PC 游戏](https://docs.xbox.com/zh-CN/tools/tools-pc/launching-on-pc.md)
- [提取 Microsoft Game Development Kit (GDK) 安装负载](https://docs.xbox.com/zh-CN/build/console-features/build-without-install/extract-setup-payload.md)
- [Visual Studio 工具集设置](https://docs.xbox.com/zh-CN/build/console-features/build-without-install/bwoi-vs-setup.md)
- [Microsoft Game Development Kit (GDK) 新增功能](https://docs.xbox.com/zh-CN/announcements/gdk/whats-new.md)
