应用安装程序文件 APIApp Installer file APIs

Windows SDK 中的 PackageManager 类提供了可用于通过应用安装程序文件添加或修改包的方法,或用于检索应用程序安装程序关联的应用程序的相关信息。The PackageManager and Package classes in the Windows SDK provide methods you can use to add or modify packages via App Installer files, or to retrieve information about apps with an App Installer association.

方法Method 说明Description 支持的最低版本Minimum supported release
PackageManager. AddPackageByAppInstallerFileAsyncPackageManager.AddPackageByAppInstallerFileAsync 允许使用 appinstaller 文件安装单个或多个应用程序包。Allows single or multiple app packages to be installed with an .appinstaller file. Windows 10 秋季创意者更新 (版本1709,版本 16299) Windows 10 Fall Creators Update (version 1709, build 16299)
PackageManager. RequestAddPackageByAppInstallerFileAsyncPackageManager.RequestAddPackageByAppInstallerFileAsync 允许使用 appinstaller 文件安装单个或多个应用程序包。Allows single or multiple app packages to be installed with an .appinstaller file. 这会在将应用包安装 () 之前执行 SmartScreen 筛选器和用户验证。This will perform a SmartScreen filter and user verification before installing the app package(s). Windows 10 秋季创意者更新 (版本1709,版本 16299) Windows 10 Fall Creators Update (version 1709, build 16299)
Package.GetAppInstallerInfoPackage.GetAppInstallerInfo 返回 appinstaller xml 文件位置。Returns the .appinstaller xml file location. 这样,应用程序开发人员便可以根据应用程序的需要检索 appinstaller xml 文件位置。This allows app developers to retrieve the .appinstaller xml file location when needed by their app. Windows 10 版本 1809(内部版本 17763)Windows 10, version 1809 (build 17763)
Package.CheckUpdateAvailabilityAsyncPackage.CheckUpdateAvailabilityAsync 检查 appinstaller 文件中列出的主应用包的更新。Checks for updates to the main app package listed in the .appinstaller file. 它允许开发人员确定是否需要更新,因为 appinstaller 策略。It allows the developer to determine if the updates are required due to .appinstaller policy. 此方法目前仅适用于通过 appinstaller 文件安装的应用程序。This method currently only works for applications installed via .appinstaller files. Windows 10 版本 1809(内部版本 17763)Windows 10, version 1809 (build 17763)

应用安装程序文件架构App Installer file schema

有关如何手动设置应用程序安装程序文件格式的详细信息,请参阅 应用安装程序文件架构参考For more information about how to manually format an App Installer file, see App installer file schema reference.