步骤 2:为 UWP 设备应用创建设备元数据

Important

设备元数据已弃用,并将在 Windows 的将来版本中删除。 有关替代功能的信息,请参阅驱动程序包容器元数据

设备应用工作流,步骤 2。

本文介绍如何使用 设备元数据创作向导 创建将 UWP 设备应用与设备关联的新设备元数据。 The wizard can also create a StoreManifest.xml file that you might need to add to your app in the next step.

UWP 设备应用是一个特殊的 UWP 应用,设备制造商创建它作为其内部或外围设备的配套。 通过使用设备元数据,设备应用可以执行特权操作,并在设备插入时自动进行安装。 有关 UWP 设备应用的详细信息,请参阅 “满足 UWP 设备应用”。

本文是分步系列的一部分。 请参阅 “逐步构建 UWP 设备应用” 以了解简介。

在您开始之前

若要使用 设备元数据创作向导,必须先安装 Microsoft Visual Studio Professional、Microsoft Visual Studio Ultimate 或 适用于 Windows 8.1 的独立 SDK,然后才能完成本文中的步骤。 安装 Microsoft Visual Studio Express for Windows 会安装不包含向导的 SDK 版本。

创建新的设备元数据

设备元数据创作向导用于创建新的设备元数据。

创建新的设备元数据

  1. 通过双击 DeviceMetadataWizard.exe,从 %ProgramFiles(x86)%\Windows Kits\8.1\bin\x86 启动设备元数据创作向导

  2. 选择 “新建设备元数据”。

  3. “选择元数据包类型 ”页上,选择 UWP 设备应用元数据,然后选择“ 下一步”。

  4. “选择设备类别 ”页上,选择应分配给设备的设备类别。 设备可以属于多个设备类别,但只能分配一个主要类别。 Select Next.

  5. 在“ 指定区域 设置”页上,选择至少一个与设备元数据包关联的区域设置。 还可以设置在计算机上不可用特定于区域设置的包时使用的默认区域设置。 Select Next.

  6. 在“ 描述设备 ”页上,输入向插入设备的最终用户显示的信息。 每个区域设置都需要型号名称和制造商。

  7. “指定硬件信息 ”页上,添加至少一个硬件 ID 和一个模型 ID。 硬件 ID 应包括公司的供应商 ID。 模型 ID 是 GUID,建议将设备元数据与支持模型 ID 的设备相关联。 Select Next.

  8. “指定 UWP 设备应用信息 ”页上:

    • If you want to enable automatic installation for your device app, or extend the camera or printer experience (which requires automatic installation), enter the Microsoft Store app information in the UWP device app box. 选择 “导入 UWP 应用清单文件 ”以自动输入 包名称发布服务器名称和UWP 应用 ID

      Warning

      请务必考虑自动安装功能不会在安装应用时向用户提供通知。 一些用户发现这种体验令人困惑和令人沮丧,并给你的应用一个糟糕的评级。

    • If your app is registering for printer notifications, fill out the Notification handlers box. In Event ID, enter the name of the print event handler. In Event Asset, enter the name of the file where that code resides.

    • If you want to specify your app as a privileged app, enter that information in the Privileged application box. The privileged app designation lets a UWP device app perform device updates, such as firmware updates. It also lets OEMs and component suppliers develop apps for internal devices.

  9. When you're finished specifying any automatic installation and privileged app details, select Next

  10. 在“ 指定 Windows 设置 ”页上,可以配置设备在断开连接时是否显示在 Device Manager 中,以及设备应如何响应自动播放激活。

    如果要将应用指定为设备的默认自动播放处理程序,请在“自动播放处理程序”框中选择“使用 UWP 设备应用”。 可以选择任何 UWP 应用或 UWP 设备应用,但该应用必须处理设备的自动播放激活,并在应用包清单中指定相应的体验 ID(如 UWP 设备应用的自动播放中所述)。

    • Package name: In the app package manifest, the Name attribute of the Identity element.

    • Publisher name: In the app package manifest, the Publisher attribute of the Identity element.

    • App ID: In the app package manifest, the ID attribute of the Application element.

    • Verb: The identifier for the AutoPlay activation. 你的应用使用它来确定激活是否来自你的设备。 You can use any value for the Verb setting, except for open, which is reserved.

    • 自动播放事件类型:保留为 设备。 在设备元数据中,向导会自动指定与 UWP 设备应用关联的体验 ID。

    如果要让其他应用充当设备的自动播放处理程序,请选择 “为已注册的应用启用自动播放”。

    有关自动播放的详细信息,请参阅 UWP 设备应用的自动播放

  11. When you're ready to continue, select Next.

  12. “查看设备元数据包 ”页上,确保所有设置都正确。 如果希望此设备元数据包在本地元数据存储中可用,请选中“ 将设备元数据包复制到本地计算机上的元数据存储 ”复选框,然后选择“ 保存”。

  13. 准备好提交设备元数据包时,或者如果需要编辑它,则必须使用 .devicemanifest-ms 文件。 .devicemetadata-ms 文件应仅用于在本地测试设备元数据。

Next step

步骤 3:向应用添加体验 ID