适用于移动设备的可预装应用Preinstallable apps for mobile devices

向移动映像添加预安装的应用To add a preinstalled app to a mobile image

用于创建 preinstallable 应用程序的过程类似于标准应用程序。The process for creating a preinstallable app is similar to that of a standard app. 在 Windows 10 开发人员中心,开发人员提交要在 Windows 10 移动版映像上预安装的应用。In the Windows 10 Dev Center, a developer submits an app that you want to preinstall on your Windows 10 Mobile image. 提交应用后,你可以请求预安装包,将其下载并添加到映像,如本主题中所述。Once the app is submitted, you can request a preinstallation package, download it, and add it to the image, as described in this topic.

若要添加 preinstallable 应用,你将需要执行以下操作:To add a preinstallable app, you will need to perform the following actions:

  • 请求预安装包Request a preinstallation package
  • 为 preinstallable 应用程序创建 provxmlCreate a .provxml for the preinstallable app
  • 通过自定义应答文件将应用添加到映像Add the app to the image with Customization answer file
  • 生成映像Build the image

有关自定义应答文件的详细信息,请参阅 自定义应答文件For more information about customization answer files, see Customization answer file. 有关使用自定义应答文件进行生成的详细信息,请参阅 使用 ImgGen 生成移动映像For more information about building with Customization answer files, see Building a mobile image using ImgGen.cmd.

请求预安装包Request a preinstallation package

将应用添加到开发人员中心的开发人员可以为其请求预安装包。Developers who have added an app to the Dev Center can request a preinstallation package for it. 然后,他们可以将预安装包直接提供给他们使用的 OEM。They can then give the preinstallation package directly to the OEM they are working with. 如果你是将此应用程序添加到操作系统映像的 OEM,则需要让应用程序的开发人员下载应用程序包,然后向你显示已下载的 zip 文件。If you are the OEM adding this application to your OS image, you would ask the developer of the application to download the application package and then give you the downloaded zip file. 不能直接访问其开发人员帐户。You cannot access their developer account directly. 获得预安装包后,可以继续执行其余步骤。Once you have the preinstall package, you can continue with the rest of the steps. 有关开发人员如何为 OEM 生成预安装包的详细信息,请参阅 为 Oem 生成预安装包For more information on how a developer generates preinstall packages for an OEM, see Generate preinstall packages for OEMs.

为 preinstallable 应用程序创建 provxml 文件Create a .provxml file for a preinstallable app

将预安装的应用添加到 Windows 10 移动操作系统映像需要一个 provxml 配置文件,该文件指定安装参数和 Windows 10 应用商店目录标识符。Adding a preinstalled app to an Windows 10 Mobile OS image requires a .provxml configuration file that specifies the installation parameters and the Windows 10 Store catalog identifiers. 具体而言,它应指定 .appx 文件的路径、许可证文件的路径和存储目录 Id。Specifically, it should specify the path to the .appx file, the path to the license file, and the Store catalog IDs. 当应用程序连接到应用商店服务以检查更新时,将使用此信息。This information is used when the app connects to the Store service to check for updates. 为了最大限度地减少出现错误的可能性,开发人员门户为你的应用程序提供了相应的 XML。To minimize the chance of error, the developer portal provides the appropriate XML for your app. 下面是 provxml 外观的示例。The following is an example of what the .provxml might look like.

<?xml version="1.0" encoding="UTF-8" ?>
   <characteristic type="AppInstall">
      <characteristic type="AppXPackage">
         <parm name="ProductID" value="{09f2d20a-7076-4970-80ac-1bc24c171d2e}"/>
         <parm name="AppXPath" value="c:\Programs\CommonFiles\Xaps\SampleApp.appx"/>
         <parm name="LicensePath" value="c:\Programs\CommonFiles\Xaps\SampleAppLicense.xml"/>
         <parm name="InstanceID" value="{03e9a435-3000-11db-89ca-0019b92FFFFF}"/>
         <parm name="OfferID" value="{03e9a435-3000-11db-89ca-0019b92FFFFF}"/>
         <parm name="PayloadID" value="{03e9a435-3000-11db-89ca-0019b92FFFFF}"/>
         <parm name="UninstallDisabled" value="false"/>
         <parm name="FullyPreInstall" value="false"/>
         <parm name="ForceUpdate" value="false"/>


预安装的应用的 provxml 文件必须遵循规定的命名约定。provxml files for preinstalled apps must follow a prescribed naming convention. 必须使用 MPAP _ name _ provxml,其中 name 和 index 可以是任意字符串。You must use MPAP_name_index.provxml, where name and index can be any strings. 通常,name 是包含预安装的应用的更新包的名称,index 是区分同名 provxml 文件的字符串。Typically, name is the name of the update package that contains the preinstalled app, and index is a string that differentiates provxml files that have the same name. 通常,索引表示为数字,如01。Often, index is represented as a number, such as 01.

provxml 标志provxml flags

这些是可在 provxml 中使用的标志。These are the flags you can use in your provxml.

标志Flag 描述Description
UninstallDisabledUninstallDisabled 此标志控制用户是否可以卸载预安装的应用。This flag controls whether a preinstalled app can be uninstalled by a user. 如果设置为 FALSE (默认值) ,则用户能够卸载预安装的应用。When set to FALSE(default), a user is able to uninstall the preinstalled app. 如果设置为 TRUE,则用户将无法卸载该应用程序。When set to TRUE, a user is not able to uninstall the app. 仅可通过 provxml 设置此标志,而不能通过应用商店更新进行重写。This flag is only settable via provxml and cannot be overridden through a Store update. 只有更新了 provxml 文件的设备更新可以更改此值。Only a device update with an updated provxml file can change this value. 理想情况下,若要保持用户体验,只应将对电话功能至关重要的应用的此标志设置为 TRUE。Ideally, to maintain the user experience, this flag should only be set to TRUE for apps that are critical to phone functionality.
ForceUpdateForceUpdate 此标志允许操作系统更新映像中的应用在更新到 Windows 10 移动版之前,尝试覆盖已在手机上安装的应用的现有版本。This flag allows an app in an OS update image to attempt to overwrite an existing version of the app already installed on the phone prior to update to Windows 10 Mobile. 此标志的默认值为 FALSE。The default value for this flag is FALSE. 请注意,由于应用程序更新是强制性的,因此,如果已安装的应用程序是针对较早版本的操作系统开发的,则将此标志设置为 TRUE 可能会导致功能降级。Be aware that because the app update is forced, setting this flag to TRUE might result in a downgrade in functionality if the already-installed app was developed for an earlier version of the OS. 通常,仅当 Windows 10 移动版的应用程序必须在更新后立即在手机上使用时,才应使用此标志,即使这意味着降级已安装的应用程序版本。In general, this flag should only be used when the Windows 10 Mobile version of the app must be on the phone immediately after update, even if it means downgrading the version of the app already installed.
FullyPreinstallFullyPreinstall 此标志控制在第一次启动/更新过程中应用是否为 MDIL 绑定,或控制是否在这些操作完成后延迟。This flag controls whether the app is MDIL bound during first boot/update or whether it is delayed until after those operations complete. 延迟 MDIL 绑定(对于未预先固定到启动状态的应用程序,这是默认行为),允许用户尽快返回到其手机。Delaying MDIL binding, which is the default behavior for apps that are not pre-pinned to Start, allows the user to get back to their phone as quickly as possible. 如果在第一次启动/更新完成后延迟绑定,应用图标将显示灰显并且状态为 "正在安装",直到延迟绑定完成。When binding is deferred till after first boot/update completes the app icon will display greyed out with a status of “installing” and cannot be run until the deferred bind completes. 完成所有延迟的绑定所需的时间取决于延迟的预加载应用数和用户的活动。The amount of time it takes to complete all deferred bindings is dependent on the number of deferred preloaded apps and the user’s activity. 标志行为如下所示:The flag behavior is as follows:
  • true : MDIL 绑定发生在首次启动或更新完成之前。true : MDIL binding occurs before first boot or update completes.
  • false :如果应用程序预先固定为 "启动",则在首次启动或更新完成之前执行 MDIL 绑定。false : If the app is pre-pinned to Start, MDIL binding is performed before first boot or update completes. 如果应用尚未提前固定,则在首次启动或更新完成之前,将延迟 MDIL 绑定。If the app is not pre-pinned to Start, MDIL binding is deferred until after first boot or update completes.
通常情况下,此值应保留为默认 (FALSE) ,除非该应用程序在首次启动或 OS 更新后立即可供运行。Generally, this value should be left as the default (FALSE) unless the app must be available to run immediately after first boot or an OS update. 应将此标志设置为 TRUE 的一些示例情况如下所示:Some example situations where this flag should be set to TRUE are the following:
  • OEM 扩展应用OEM extension apps
  • 电话拨号程序-已安装的应用Phone dialer-installed apps
  • OEM 服务代理OEM service agents
  • 关键系统设置应用Critical system settings apps

将应用添加到映像Add the app to the image

预安装应用会使用 customizations.xml 应答文件添加到操作系统映像。Preinstalling apps are added to the OS image using a customizations.xml answer file. 若要创建 customizations.xml 应答文件,请首先 安装 Windows 配置设计器,然后 创建预配包To create the customizations.xml answer file, first install the Windows Configuration Designer, and then create a provisioning package. 然后,可以打开项目文件夹以查找 customizations.xml 文件。You can then open the project folder to find the customizations.xml file.

若要在映像中包括预安装的应用,必须将 Application 元素添加到 customizations.xml 文件中,并具有适当的定义属性。To include preinstalled apps in your image, you must add the Application element to your customizations.xml file with the appropriate defining attributes. 下面的代码示例演示如何将应用添加到预安装的自定义应答文件中。The following code sample illustrates how an app would be added to a customization answer file for preinstalling.

      <Application License="$(CAFE_OUTPUT_DIR)\content\App_MobileTV_7e7cc86e_e1c0_476a_ac88_db3c9ffffabb\MobileTV_License.xml" ProvXML="$(CAFE_OUTPUT_DIR)\content\App_MobileTV_7e7cc86e_e1c0_476a_ac88_db3c9ffffabb\MPAP_MobileTV_01.provxml" Source="$(CAFE_OUTPUT_DIR)\content\App_MobileTV_7e7cc86e_e1c0_476a_ac88_db3c9ffffabb\MobileTV.xap"/>
      <Application License="$(CAFE_OUTPUT_DIR)\content\App_AudioSettings_373cb76e_7f6c_45aa_8633_b00e85c73261\audio_License.xml" ProvXML="$(CAFE_OUTPUT_DIR)\content\App_AudioSettings_373cb76e_7f6c_45aa_8633_b00e85c73261\MPAP_audio_01.provxml" Source="$(CAFE_OUTPUT_DIR)\content\App_AudioSettings_373cb76e_7f6c_45aa_8633_b00e85c73261\audio.appx"/>
      <Application License="$(CAFE_OUTPUT_DIR)\content\App_MicrosoftHealthApp_0168b504_ca18_46b8_b60a_0f6fdc271c81\MicrosoftHealthApp_License.xml" ProvXML="$(CAFE_OUTPUT_DIR)\content\App_MicrosoftHealthApp_0168b504_ca18_46b8_b60a_0f6fdc271c81\MPAP_MicrosoftHealthApp_01.provxml" Source="$(CAFE_OUTPUT_DIR)\content\App_MicrosoftHealthApp_0168b504_ca18_46b8_b60a_0f6fdc271c81\MicrosoftHealthApp.appxbundle"/>


Provxml 文件必须位于 "$ (commonfiles) \ 预配 \ OEM" 目录中。The provxml file must be placed in the "$(runtime.commonfiles)\Provisioning\OEM" directory. 必须将许可证文件和应用程序包 ( .xap 或 .appx) 置于 "$ (commonfiles) \ xaps" 目录中The license file and app package (.xap or .appx) must be placed in the "$(runtime.commonfiles)\xaps" directory

配置 customizations.xml 应答文件后,使用 Windows 配置设计器命令行界面生成映像。After you've configured your customizations.xml answer file, build the image using the Windows Configuration Designer command-line interface. 有关说明,请参阅 Windows 配置设计器命令行接口See Windows Configuration Designer command-line interface for instructions.

生成映像Build the image

按照使用 Imggen 构建自定义的移动映像中的步骤操作Follow the steps in the Build a customized mobile image using imggen