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

# XPackageUninstallUWPInstance

> XPackageUninstallUWPInstance

# XPackageUninstallUWPInstance

如果当前用户已为指定包安装了通用 Windows 平台 (UWP) 实例，则卸载该实例。

## 语法

```cpp theme={null}
HRESULT XPackageUninstallUWPInstance(  
         const char* packageName  
)  
```

### 参数

*packageName*   \_In\_z\_\
类型：char\*

要卸载的包的名称。此值必须与 UWP 包的 `AppXManifest` 中 `Identity` 元素的 `Name` 属性值匹配。

### 返回值

类型：HRESULT

如果包已被卸载（或用户未安装该包），则返回 `S_OK`；否则，返回 HRESULT 错误代码。如果平台不支持此 API，则返回 `E_NOTIMPL`。

## 备注

> [!NOTE]
>
> 此函数仅适用于 PC 平台。

如果当前用户已安装 `packageName` 中指定包的通用 Windows 平台 (UWP) 实例，则此函数会卸载该实例。如果当前用户未安装指定包的 UWP 实例，则不会发生任何操作，函数返回 `S_OK`。

要卸载的包的发布者必须与调用此函数的包的发布者匹配；否则会发生错误。

## 要求

**头文件：** XPackage.h

**库：** xgameruntime.lib

**支持的平台**：Windows、XBOX One 系列主机和 XBOX Series 主机

## 另请参阅

[XPackageUninstallChunks](https://docs.xbox.com/zh-CN/reference/system/xpackage/functions/xpackageuninstallchunks.md)\
[XPackage](https://docs.xbox.com/zh-CN/reference/system/xpackage/xpackage_members.md)


## Related topics

- [XPackage（API 内容）](https://docs.xbox.com/zh-CN/reference/system/xpackage/xpackage_members.md)
- [在 Unity 项目中使用 GDK API 的 C# 包装器](https://docs.xbox.com/zh-CN/build/gdk-and-engines/unity/unity-api-wrappers.md)
- [Uninstall](https://docs.xbox.com/zh-CN/reference/tools/xtf/xtfapplication/classes/IXtfApplicationClient/methods/uninstall-ixtfapplicationclient-xtfapplication-xbox-microsoft-m.md)
- [XPackageUninstallPackage](https://docs.xbox.com/zh-CN/reference/system/xpackage/functions/xpackageuninstallpackage.md)
- [XPackageUninstallChunks](https://docs.xbox.com/zh-CN/reference/system/xpackage/functions/xpackageuninstallchunks.md)
