使用 Visual Studio 打包 UWP 应用Package a UWP app with Visual Studio

若要出售你的通用 Windows 平台 (UWP) 应用或将其分配给其他用户,你需要将其打包。To sell your Universal Windows Platform (UWP) app or distribute it to other users, you need to package it. 如果你不想通过 Microsoft Store 分发应用,也可以将应用包直接旁加载到设备上或通过 Web 安装分发它。If you don't want to distribute your app through Microsoft Store, you can sideload the app package directly to a device or distribute it via Web Install. 本文介绍使用 Visual Studio 配置、创建和测试 UWP 应用包的过程。This article describes the process of configuring, creating, and testing a UWP app package using Visual Studio. 有关管理和部署业务线 (LOB) 应用的详细信息,请参阅企业应用管理For more information about managing and deploying line-of-business (LOB) apps, see Enterprise app management.

在 Windows 10 中,您可以提交应用包、 应用程序捆绑包或一个完整的应用程序包上传文件合作伙伴中心In Windows 10, you can submit an app package, app bundle, or a complete app package upload file to Partner Center. 这些选项,将提交一个应用程序包上传文件将提供最佳体验。Of these options, submitting an app package upload file will provide the best experience.

应用包类型Types of app packages

  • 应用程序包 (.appx 或.msix)App Package (.appx or .msix)
    包含应用的文件,其格式可以旁加载到设备上。A file that contains your app in a format that can be sideloaded on a device. Visual Studio 创建的任何单个应用包文件是用于将应用提交到合作伙伴中心和应该用于旁加载,并且仅出于测试目的。Any single app package file created by Visual Studio is not intended to be submitted to Partner Center and should be used for sideloading and testing purposes only. 如果你想要将应用提交到合作伙伴中心,使用应用程序包上传文件。If you want to submit your app to Partner Center, use the app package upload file.

  • 应用程序捆绑包 (.appxbundle 或.msixbundle)App Bundle (.appxbundle or .msixbundle)
    应用程序包可以包含多个应用包,每个包都构建为支持特定的设备体系结构。An app bundle is a type of package that can contain multiple app packages, each of which is built to support a specific device architecture. 例如,一个应用程序包可以包含三个独立的应用包,它们分别用于 x86、x64 和 ARM 配置。For example, an app bundle can contain three separate app packages for the x86, x64, and ARM configurations. 应尽可能生成应用程序包,因为它们使你的应用能够在尽可能广泛的设备上使用。App bundles should be generated whenever possible because they allow your app to be available on the widest possible range of devices.

  • 应用程序包上传文件 (.appxupload 或.msixupload)App Package Upload File (.appxupload or .msixupload)
    一个可以包含多个应用包或一个应用程序包以支持各种处理器体系结构的文件。A single file that can contain multiple app packages or an app bundle to support various processor architectures. 应用程序包上传文件还包含一个符号文件分析应用程序性能在 Microsoft Store 中发布您的应用程序后。The app package upload file also contains a symbol file to Analyze app performance after your app has been published in the Microsoft Store. 如果您正使用 Visual Studio 对应用程序提交到合作伙伴中心以发布的目的,将为你自动创建此文件。This file will be automatically created for you if you are packaging your app with Visual Studio with the intention of submitting it to Partner Center for publishing.

以下是准备和创建应用包的步骤概述:Here is an overview of the steps to prepare and create an app package:

  1. 在打包应用前Before packaging your app. 请按照下列步骤以确保您的应用程序已准备好为合作伙伴中心提交而进行打包。Follow these steps to ensure your app is ready to be packaged for Partner Center submission.
  2. 配置应用包Configure an app package. 使用 Visual Studio 清单设计器配置程序包。Use the Visual Studio manifest designer to configure the package. 例如,添加磁贴图像并选择应用支持的方向。For example, add tile images and choose the orientations your app supports.
  3. 创建应用包上传文件Create an app package upload file. 使用 Visual Studio 应用包向导创建应用包,然后使用 Windows 应用认证工具包验证程序包。Use the Visual Studio app package wizard to create an app package, then certify your package with the Windows App Certification Kit.
  4. 旁加载应用包Sideload your app package. 将应用旁加载到设备后,你可以测试该应用是否按预期运行。After sideloading your app to a device, you can test that it works as you expect it to.

完成上述步骤之后,你可以随时分发你的应用。After you have completed the steps above, you are ready to distribute your app. 如果您不计划出售,因为它是仅供内部用户的业务线 (LOB) 应用,您可以旁加载的任何 Windows 10 设备上安装此应用。If you have a line-of-business (LOB) app that you don't plan to sell because it's for internal users only, you can sideload this app to install it on any Windows 10 device.

在打包应用前Before packaging your app

  1. 测试您的应用程序。Test your app. 打包合作伙伴中心提交应用之前,请确保它按预期您计划支持的所有设备系列上工作。Before you package your app for Partner Center submission, make sure it works as expected on all device families that you plan to support. 这些设备系列可能包括桌面设备、移动设备、Surface Hub、Xbox、IoT 设备或其他设备。These device families may include desktop, mobile, Surface Hub, Xbox, IoT devices, or others. 有关部署和测试应用程序使用 Visual Studio 的详细信息,请参阅部署和调试 UWP 应用For more information about deploying and testing your app using Visual Studio, see Deploying and debugging UWP apps.
  2. 优化您的应用程序。Optimize your app. 你可以使用 Visual Studio 的分析和调试工具来优化你的 UWP 应用的性能。You can use Visual Studio’s profiling and debugging tools to optimize the performance of your UWP app. 例如,用于 UI 响应能力的时间线工具、内存使用工具、CPU 使用工具等。For example, the Timeline tool for UI responsiveness, the Memory Usage tool, the CPU Usage tool, and more. 有关这些工具的详细信息,请参阅分析功能教程主题。For more information about these tools, see the Profiling Feature Tour topic.
  3. 检查.NET Native 兼容性 (对于 VB 和C#应用程序)。Check .NET Native compatibility (for VB and C# apps). 在通用 Windows 平台中,有一个本机编译器可以提升应用的运行时性能。In the Universal Windows Platform, there is a native compiler that will improve the runtime performance of your app. 通过这项更改,你应在该编译环境中测试你的应用。With this change, you should test your app in this compilation environment. 默认情况下,Release 版本配置会启用 .NET 本机工具链,因此请务必使用此 Release 配置测试应用并检查应用是否按预期运行。By default, the Release build configuration enables the .NET native toolchain, so it's important to test your app with this Release configuration and check that your app behaves as expected. 调试 .NET Native Windows 通用应用对在使用 .NET Native 时可能遇到的一些常见调试问题做了更详细的说明。Some common debugging issues that can happen with .NET Native are explained in more detail in Debugging .NET Native Windows Universal Apps.

配置应用包Configure an app package

应用清单文件 (Package.appxmanifest.xml) 是一个 XML 文件,其中包含创建应用包所需的属性和设置。The app manifest file (Package.appxmanifest) is an XML file that contains the properties and settings required to create your app package. 例如,应用清单文件中的属性描述了要用作应用的磁贴的映像和应用在用户旋转设备时支持的方向。For example, properties in the app manifest file describe the image to use as the tile of your app and the orientations that your app supports when a user rotates the device.

Visual Studio 的清单设计器让你能够更新清单文件,而无需编辑文件的原始 XML。The Visual Studio manifest designer allows you to update the manifest file without editing the raw XML of the file.

使用清单设计器配置程序包Configure a package with the manifest designer

  1. 解决方案资源管理器中,展开你的 UWP 应用的项目节点。In Solution Explorer, expand the project node of your UWP app.

  2. 双击 Package.appxmanifest 文件。Double-click the Package.appxmanifest file. 如果清单文件已经在 XML 代码视图中打开,Visual Studio 会提示你关闭该文件。If the manifest file is already open in the XML code view, Visual Studio prompts you to close the file.

  3. 现在,你可以确定如何配置你的应用。Now you can decide how to configure your app. 每个选项卡都包含可以配置的有关应用的信息,以及更多信息的链接(如果需要)。Each tab contains information that you can configure about your app and links to more information if necessary.
    Visual Studio 中的清单设计器

    检查是否在“视觉资源”选项卡上拥有 UWP 应用所需的所有图像。 Check that you have all the images that are required for a UWP app on the Visual Assets tab.

    你可以从打包选项卡中输入发布数据。From the Packaging tab, you can enter publishing data. 你可以从此位置选择用于对你的应用进行签名的证书。This is where you can choose which certificate to use to sign your app. 所有 UWP 应用都必须使用证书进行签名。All UWP apps must be signed with a certificate.

    重要

    如果你是在 Microsoft Store 中发布应用,将使用你的受信任的证书进行签名。If you're publishing your app in Microsoft Store, your app will be signed with a trusted certificate for you. 这让用户能够安装和运行你的应用,而不必安装关联的应用签名证书。This allows the user to install and run your app without installing the associated app signing certificate.

    如果你不打算发布应用,只想旁加载应用包,则你首先需要信任该程序包。If you are not publishing your app and simply want to sideload an app package, you first need to trust the package. 要信任该程序包,必须在用户设备上安装证书。To trust the package, the certificate must be installed on the user's device. 有关旁加载的详细信息,请参阅启用设备进行开发For more information about sideloading, see Enable your device for development.

  4. 在你对应用进行必要的编辑后,请保存你的 Package.appxmanifest 文件。Save your Package.appxmanifest file after you have made the necessary edits for your app.

如果您通过 Microsoft Store 应用分发,Visual Studio 可以将您的软件包关联与应用商店。If you are distributing your app via the Microsoft Store, Visual Studio can associate your package with the Store. 若要执行此操作,右键单击你在解决方案资源管理器中的项目名称并选择应用商店->应用程序与应用商店关联To do this, right-click your project name in Solution Explorer and choose Store->Associate App with the Store. 在中,也可以这样做创建应用程序包向导中,以下部分中所述。You can also do this in the Create App Packages wizard, which is described in the following section. 在关联应用时,会自动更新清单设计器的“打包”选项卡中的某些字段。When you associate your app, some of the fields in the Packaging tab of the manifest designer are automatically updated.

创建应用包上传文件Create an app package upload file

若要通过 Microsoft Store 应用分发必须创建应用程序包 (.appx 或.msix)、 应用程序捆绑包 (.appxbundle 或.msixbundle) 或一个应用程序包上传文件 (.appxupload 或.msixupload) 和打包应用程序提交到合作伙伴中心.To distribute an app through Microsoft Store you must create an app package (.appx or .msix), app bundle (.appxbundle or .msixbundle), or an app package upload file (.appxupload or .msixupload) and submit the packaged app to Partner Center. 尽管可以提交到合作伙伴中心单独应用包或应用程序捆绑包,但我们建议你提交的应用程序包上传文件。Although it is possible to submit an app package or app bundle to Partner Center alone, we recommend that you submit an app package upload file. 可以通过创建一个应用程序包上传文件创建应用程序包Visual Studio 中,或者您的向导可以创建一个手动从现有的应用包或应用程序捆绑包。You can create an app package upload file by using the Create App Packages wizard in Visual Studio, or you can create one manually from existing app packages or app bundles.

备注

如果你想要手动创建应用包 (.appx 或.msix) 或应用程序捆绑包 (.appxbundle 或.msixbundle),请参阅MakeAppx.exe 工具创建应用程序包If you want to create an app package (.appx or .msix) or app bundle (.appxbundle or .msixbundle) manually, see Create an app package with the MakeAppx.exe tool.

创建使用 Visual Studio 在应用程序包上传文件Create your app package upload file using Visual Studio

  1. 解决方案资源管理器中,打开适用于你的 UWP 应用项目的解决方案。In Solution Explorer, open the solution for your UWP app project.

  2. 右键单击该项目,然后依次选择 Microsoft Store->创建应用包Right-click the project and choose Store->Create App Packages. 如果此选项处于禁用状态或根本没有显示,请检查该项目是否为通用 Windows 项目。If this option is disabled or does not appear at all, check that the project is a Universal Windows project.
    导航到创建应用程序包的上下文菜单Context menu with navigation to Create App Packages

    将显示创建应用包向导。The Create App Packages wizard appears.

  3. 选择我想要创建要上传到 Microsoft Store,使用新的应用程序名称的包中第一个对话框,然后单击下一步Select I want to create packages to upload to the Microsoft Store using a new app name in the first dialog and then click Next.
    创建包所示的对话框窗口Create Your Packages dialog window shown

    如果已将你的项目与应用商店中的应用,也可以创建关联应用商店应用程序的包的选项。If you have already associated your project with an app in the Store, you also have an option to create packages for the associated Store app. 如果愿意我想要创建包以进行旁加载,Visual Studio 将生成的应用程序包上传 (.msixupload 或.appxupload) 文件合作伙伴中心提交。If you choose I want to create packages for sideloading, Visual Studio will not generate the app package upload (.msixupload or .appxupload) file for Partner Center submissions. 如果你仅希望旁加载应用以在内部设备上运行它或用于测试目的,那么你可以选择此选项。If you only want to sideload your app to run it on internal devices or for testing purposes, then you can select this option. 有关旁加载的详细信息,请参阅启用设备进行开发For more information about sideloading, see Enable your device for development.

  4. 在下一页上,使用你开发人员帐户登录到合作伙伴中心。On the next page, sign in with your developer account to Partner Center. 如果你还没有开发者帐户,该向导将帮助你创建一个。If you don't have a developer account yet, the wizard will help you create one. 使用所示的应用名称选择创建应用程序包窗口Create App Packages window with app name selection shown

  5. 从当前已注册到你的帐户,应用程序的列表中选择您的包的应用名称,或如果你有不保留在合作伙伴中心中保留一个新。Select the app name for your package from the list of apps currently registered to your account, or reserve a new one if you have not already reserved one in Partner Center.

  6. 确保在 Select and Configure Packages 对话框中选择全部三种体系结构配置(x86、x64 和 ARM),以确保你的应用能够部署到最广泛的设备上。Make sure you select all three architecture configurations (x86, x64, and ARM) in the Select and Configure Packages dialog to ensure that your app can be deployed to the widest range of devices. 生成应用程序包列表框中,选择始终In the Generate app bundle listbox, select Always. 应用捆绑包 (.appxbundle 或.msixbundle) 优先,通过单个应用包文件因为它包含的应用包配置为每种类型的处理器体系结构的集合。An app bundle (.appxbundle or .msixbundle) is preferred over a single app package file because it contains a collection of app packages configured for each type of processor architecture. 当你选择生成应用捆绑包时,应用程序捆绑包将包含在最终应用程序包上载 (.appxupload 或.msixupload) 文件以及调试和崩溃分析信息中。When you choose to generate the app bundle, the app bundle will be included in the final app package upload (.appxupload or .msixupload) file along with debugging and crash analytic information. 如果你不确定该选择哪种体系结构,或者想了解有关各种设备使用哪种体系结构的详细信息,请参阅应用包体系结构If you're unsure which architecture(s) to choose, or want to learn more about which architectures are used by various devices, see App package architectures.
    使用包配置所示创建应用程序包窗口Create App Packages window with package configuration shown

  7. 包含到完整 PDB 符号文件分析应用程序性能从合作伙伴中心后发布你的应用。Include full PDB symbol files to Analyze app performance from Partner Center after your app has been published. 配置任何其他详细信息,例如版本编号或包输出位置。Configure any additional details such as version numbering or the package output location.

  8. 单击创建生成应用包。Click Create to generate the app package. 如果您选择某一我想要创建要上传到 Microsoft Store 的包中的选项的步骤 3,并且创建用于合作伙伴中心提交包时,该向导将创建包上载 (.appxupload 或.msixupload) 文件。If you selected one of the I want to create packages to upload to the Microsoft Store options in step 3 and are creating a package for Partner Center submission, the wizard will create a package upload (.appxupload or .msixupload) file. 如果所选我想要创建包以进行旁加载在步骤 3 中,向导将创建一个应用程序包或应用捆绑包基于在步骤 6 中所选内容。If you selected I want to create packages for sideloading in step 3, the wizard will create either a single app package or an app bundle based on your selections in step 6.

  9. 已成功打包您的应用程序,您将看到此对话框并可以检索指定的输出位置上的应用程序包上传文件。When your app has been successfully packaged, you will see this dialog and you can retrieve your app package upload file from the specified output location. 此时,你可以验证你在本地计算机或远程计算机上的应用程序包自动执行应用商店提交At this point, you can validate your app package on the local machine or a remote machine and automate store submissions. 包创建已完成窗口中,但显示的验证选项Package creation completed window with validation options shown

手动创建应用程序包上传文件Create your app package upload file manually

  1. 将以下文件放置在文件夹中:Place the following files in a folder:
    • 一个或多个应用包 (.msix 或.appx) 或应用程序捆绑 (.msixbundle 或.appxbundle)。One or more app packages (.msix or .appx) or an app bundle (.msixbundle or .appxbundle).
    • .Appxsym 文件。An .appxsym file. 这是一个压缩的.pdb 文件包含用于对应用程序的公共符号崩溃分析在合作伙伴中心。This is a compressed .pdb file containing public symbols of your app used for crash analytics in Partner Center. 可以忽略此文件中,但如果这样做,没有崩溃分析或调试信息将可供您的应用程序。You can omit this file, but if you do, no crash analytic or debugging information will be available for your app.
  2. 压缩文件夹。Zip the folder.
  3. .Zip 的压缩的文件夹扩展名称更改为.msixupload 或.appxupload。Change the zipped folder extension name from .zip to .msixupload or .appxupload.

验证应用包Validate your app package

您将其提交到合作伙伴中心在本地或远程计算机上的证书之前,请验证您的应用程序。Validate your app before you submit it to Partner Center for certification on a local or remote machine. 你只能验证应用包的发布版本而不是调试版本。You can only validate release builds for your app package, not debug builds. 将应用提交到合作伙伴中心的详细信息,请参阅应用程序提交For more information on submitting your app to Partner Center, see App submissions.

验证本地应用程序包Validate your app package locally

  1. 在最后一个已创建包创建应用程序包向导中,保留本地计算机选项,并单击启动Windows 应用认证工具包In the final Package Creation Completed page of the Create App Packages wizard, leave the Local machine option selected and click Launch Windows App Certification Kit. 有关使用 Windows 应用认证工具包测试应用的详细信息,请参阅 Windows 应用认证工具包For more information about testing your app with the Windows App Certification Kit, see Windows App Certification Kit.

    Windows 应用认证工具包 (WACK) 执行各种测试,并返回结果。The Windows App Certification Kit (WACK) performs various tests and returns the results. 有关更具体的信息,请参阅 Windows 应用认证工具包测试See Windows App Certification Kit tests for more specific information.

    如果你有想要用于测试的远程 Windows 10 设备,需要在该设备上手动安装 Windows 应用认证工具包。If you have a remote Windows 10 device that you want to use for testing, you will need to install the Windows App Certification Kit manually on that device. 下一节将指导你完成这些步骤。The next section will walk you through these steps. 完成该操作后,你可以选择远程计算机并单击启动 Windows 应用认证工具包,以连接到远程设备并运行验证测试。After you've done that, then you can select Remote machine and click Launch Windows App Certification Kit to connect to the remote device and run the validation tests.

  2. WACK 完毕且应用已通过认证后,已准备好将应用提交到合作伙伴中心。After WACK has finished and your app has passed certification, you are ready to submit your app to Partner Center. 请确保上传正确的文件。Make sure you upload the correct file. 可以在你的解决方案的根文件夹中找到该文件的默认位置\[AppName]\AppPackages且将结束.appxupload 或.msixupload 文件扩展名。The default location of the file can be found in the root folder of your solution \[AppName]\AppPackages and it will end with the .appxupload or .msixupload file extension. 名称将是窗体[AppName]_[AppVersion]_x86_x64_arm_bundle.appxupload[AppName]_[AppVersion]_x86_x64_arm_bundle.msixupload如果您选择与所选的包体系结构的所有应用程序捆绑包。The name will be of the form [AppName]_[AppVersion]_x86_x64_arm_bundle.appxupload or [AppName]_[AppVersion]_x86_x64_arm_bundle.msixupload if you opted for an app bundle with all of the package architecture selected.

验证远程 Windows 10 设备上的应用包Validate your app package on a remote Windows 10 device

  1. 通过启用 Windows 10 设备进行开发启用设备进行开发说明。Enable your Windows 10 device for development by following the Enable your device for development instructions.

    重要

    适用于 Windows 10,无法验证你的远程 ARM 设备上的应用程序包。You cannot validate your app package on a remote ARM device for Windows 10.

  2. 下载并安装适用于 Visual Studio 的远程工具。Download and install the remote tools for Visual Studio. 这些工具用于远程运行 Windows 应用认证工具包。These tools are used to run the Windows App Certification Kit remotely. 你可以通过访问在远程计算机上运行 UWP 应用获取有关这些工具的详细信息,包括下载位置。You can get more information about these tools including where to download them by visiting Run UWP apps on a remote machine.
  3. 下载所需Windows 应用认证工具包然后将其安装在远程 Windows 10 设备。Download the required Windows App Certification Kit and then install it on your remote Windows 10 device.
  4. 在向导的“程序包创建已完成”页面上,选择“远程计算机”选项按钮,然后选择“测试连接”按钮旁边的省略号按钮。 On the Package Creation Completed page of the wizard, choose the Remote Machine option button, and then choose the ellipsis button next to the Test Connection button.

    备注

    远程计算机选项按钮已选中至少一个支持验证的解决方案配置时才可用。The Remote Machine option button is available only if you selected at least one solution configuration that supports validation. 有关使用 WACK 测试应用的详细信息,请参阅 Windows 应用认证工具包For more information about testing your app with the WACK, see Windows App Certification Kit.

  5. 指定你的子网内部的设备规格,或提供你的子网外部的设备的域名服务器 (DNS) 名称或 IP 地址。Specify a device form inside your subnet, or provide the Domain Name Server (DNS) name or IP address of a device that's outside of your subnet.
  6. 身份验证模式列表中,如果你的设备没有要求你使用 Windows 凭据登录该设备,请选择In the Authentication Mode list, choose None if your device doesn't require you to log onto it by using your Windows credentials.
  7. 选择选择按钮,然后选择启动 Windows 应用认证工具包按钮。Choose the Select button, and then choose the Launch Windows App Certification Kit button. 如果远程工具正在该设备上运行,Visual Studio 将与其连接,然后执行验证测试。If the remote tools are running on that device, Visual Studio connects to the device and then performs the validation tests. 请参阅 Windows 应用认证工具包测试See Windows App Certification Kit tests.

自动执行应用商店提交Automate Store submissions

从 Visual Studio 2019 开始,你可以生成的.appxupload 文件到 Microsoft Store 从 IDE 直接通过选择提交自动将提交到 Microsoft Store Windows 应用程序认证包在验证之后选项的末尾创建应用程序包向导Starting in Visual Studio 2019, you can submit the generated .appxupload file to the Microsoft Store directly from the IDE by selecting the Automatically submit to the Microsoft Store after Windows App Certification Kit validation option at the end of the Create App Packages wizard. 此功能利用用于访问合作伙伴中心帐户信息发布您的应用程序所需的 Azure Active Directory。This feature leverages Azure Active Directory for accessing the Partner Center account info needed to publish your app. 若要使用此功能,您将需要将 Azure Active Directory 与你的合作伙伴中心帐户相关联并检索所需的提交的多个凭据。To use this feature, you'll need associate Azure Active Directory with your Partner Center account and retrieve several credentials required for submissions.

将 Azure Active Directory 与你的合作伙伴中心帐户相关联Associate Azure Active Directory with your Partner Center account

您可以检索所需的自动存储区提交的凭据之前,您必须首先按照这些步骤合作伙伴中心仪表板如果你尚未这样做已经。Before you can retrieve the credentials that are required for automatic Store submissions, you must first follow these steps in the Partner Center dashboard if you have not done so already.

  1. 将你的合作伙伴中心帐户与你组织的 Azure Active Directory 相关联Associate your Partner Center account with your organization's Azure Active Directory. 如果你的组织已经使用 Office 365 或 Microsoft 的其他业务服务,则你已经具有 Azure AD。If your organization already uses Office 365 or other business services from Microsoft, you already have Azure AD. 否则,您可以创建一个新的 Azure AD 租户从合作伙伴中心内不收取附加费用。Otherwise, you can create a new Azure AD tenant from within Partner Center at no additional charge.

  2. 添加到你的合作伙伴中心帐户的 Azure AD 应用程序Add an Azure AD application to your partner Center account. 此 Azure AD 应用程序表示应用程序或服务,将用于访问你的开发人员中心帐户的提交。This Azure AD application represents the app or service that you will use to access submissions for your Dev Center account. 必须将分配到此应用程序Manager角色。You must assign this application to the Manager role. 如果此应用程序已存在于你的 Azure AD 目录中,你可以在添加 Azure AD 应用程序页面上选择它,以将其添加到你的开发人员中心帐户。If this application already exists in your Azure AD directory, you can select it on the Add Azure AD applications page to add it to your Dev Center account. 如果没有此应用程序,你可以在添加 Azure AD 应用程序页面上创建新的 Azure AD 应用程序。Otherwise, you can create a new Azure AD application on the Add Azure AD applications page.

检索用于提交所需的凭据Retrieve the credentials required for submissions

接下来,可以检索所需的提交的合作伙伴中心凭据: Azure 租户 ID,则客户端 ID客户端密钥Next, you can retrieve the Partner Center credentials required for submissions: the Azure Tenant ID, the Client ID and the Client key.

  1. 转到合作伙伴中心仪表板并使用你的 Azure AD 凭据登录。Go to the Partner Center dashboard and sign in with your Azure AD credentials.

  2. 在合作伙伴中心仪表板中,选择齿轮图标 (靠近仪表板的右上角),然后选择开发人员设置On the Partner Center dashboard, select the gear icon (near the upper right corner of the dashboard) and then select Developer settings.

  3. 在中设置菜单中的左窗格中,单击用户In the Settings menu in the left pane, click Users.

  4. 单击 Azure AD 应用程序,请转到应用程序的设置名称。Click the name of your Azure AD application to go to the application's settings. 在此页上,复制租户 ID客户端 ID值。On this page, copy the Tenant ID and Client ID values.

  5. 在中密钥部分中,单击添加新的密钥In the Keys section, click Add new key. 在下一个屏幕上,复制密钥值,该值对应于客户端机密。On the next screen, copy the Key value, which corresponds to the client secret. 你将无法再访问此信息后离开此页上,因此请确保不会丢失。You will not be able to access this info again after you leave this page, so make sure to not lose it. 有关详细信息,请参阅管理 Azure AD 应用程序的密钥For more information, see Manage keys for an Azure AD application.

在 Visual Studio 中配置自动应用商店提交Configure automatic Store submissions in Visual Studio

完成前面的步骤后,你可以在 Visual Studio 2019 中配置自动应用商店提交。After you complete the previous steps, you can configure automatic Store submissions in Visual Studio 2019.

  1. 在末尾创建应用程序包向导,选择自动提交到 Microsoft Store Windows 应用程序认证包在验证之后单击重新配置.At the end of the Create App Packages wizard, select Automatically submit to the Microsoft Store after Windows App Certification Kit validation and click Reconfigure.

  2. 在中配置 Microsoft Store 提交设置对话框中,输入 Azure 租户 ID、 客户端 ID 和客户端密钥。In the Configure Microsoft Store Submission settings dialog, enter the Azure tenant ID, Client ID, and Client key.

    配置 Microsoft Store 提交设置

    重要

    你的凭据可以保存到配置文件以供将来提交中使用Your credentials can be saved to your profile to be used in future submissions

  3. 单击 “确定”Click OK.

WACK 测试完成后,将开始提交。The submission will start after the WACK test have finished. 你可以跟踪在提交进度验证和发布窗口。You can track the submission progress in the Verify and Publish window.

验证并发布进度

旁加载应用包Sideload your app package

使用 UWP 应用包时,应用不会安装到设备,因为它们是使用桌面应用程序。With UWP app packages, apps aren't installed to a device as they are with desktop apps. 通常,你会从 Microsoft Store 下载 UWP 应用,这也会将应用安装到你的设备上。Typically, you download UWP apps from Microsoft Store, which also installs the app to your device for you. 你可以在不将应用发布到 Microsoft Store 的情况下安装应用(旁加载)。Apps can be installed without being published in the Store (sideloading). 这允许您安装和测试应用程序使用的应用包文件已创建的。This lets you install and test apps using the app package file that you created. 如果你有一款不想在应用商店中出售的应用(如业务线 (LOB) 应用),你可以旁加载该应用,以便你的公司中的其他用户也可以使用它。If you have an app that you don’t want to sell in the Store, like a line-of-business (LOB) app, you can sideload that app so that other users in your company can use it.

您可以旁加载应用在目标设备上的之前,必须启用设备进行开发Before you can sideload your app on a target device, you must enable your device for development.

旁加载应用程序在 Windows 10 移动版设备上,使用WinAppDeployCmd.exe工具。To sideload your app on a Windows 10 Mobile device, use the WinAppDeployCmd.exe tool. 为台式计算机、 笔记本电脑和平板电脑,请按照下面的说明。For desktops, laptops, and tablets, follow the instructions below.

旁加载应用程序打包在 Windows 10 周年更新或更高版本Sideload your app package on Windows 10 Anniversary Update or later

在 Windows 10 周年更新 (Windows 10,版本 1607年) 中引入,可以只需通过双击应用包文件安装应用包。Introduced in the Windows 10 Anniversary Update (Windows 10, version 1607), app packages can be installed simply by double clicking the app package file. 为此,导航到你的应用包或应用程序捆绑包文件,并双击它。To use this, navigate to your app package or app bundle file, and double click it. 应用安装程序启动,并提供基本的应用信息,以及安装按钮,安装进度栏和任何相关的错误消息。App Installer launches and provides the basic app information as well as an install button, installation progress bar, and any relevant error messages.

安装名为 Contoso 的示例应用时的应用安装程序显示

备注

应用安装程序假定应用程序受信任设备。App Installer assumes that the app is trusted by the device. 如果你旁加载开发人员或企业应用,则需要向存储在设备上的“Trusted People or Trusted Publishers Certification Authorities”安装签名证书。If you are sideloading a developer or enterprise app, you will need to install the signing certificate to the Trusted People or Trusted Publishers Certification Authorities store on the device. 如果你不确定如何执行此操作,请参阅安装测试证书If you're not sure how to do this, see Installing Test Certificates.

在以前版本的 Windows 应用包旁加载Sideload your app package on previous versions of Windows

  1. 将要安装的应用版本的文件夹复制到目标设备。Copy the folders for the app version to install on the target device.

    如果你已创建应用程序包,那么你将拥有一个基于版本号的文件夹和一个 *_Test 文件夹。If you've created an app bundle, then you will have a folder based on the version number and a *_Test folder. 例如以下两个文件夹(其中要安装的版本是 1.0.2.0):For example these two folders (where the version to install is 1.0.2.0):

    • C:\Projects\MyApp\MyApp\AppPackages\MyApp_1.0.2.0
    • C:\Projects\MyApp\MyApp\AppPackages\MyApp_1.0.2.0_Test

    如果你没有应用程序包,可以复制正确体系结构的文件夹和相应的 *_Test 文件夹。If you don't have an app bundle, copy the folder for the correct architecture and its corresponding *_Test folder. 这两个文件夹是具有 x64 体系结构及其 *_Test 文件夹的应用包的示例:These two folders are an example of an app package with the x64 architecture and its *_Test folder:

    • C:\Projects\MyApp\MyApp\AppPackages\MyApp_1.0.2.0_x64
    • C:\Projects\MyApp\MyApp\AppPackages\MyApp_1.0.2.0_x64_Test
  2. 在目标设备上,打开 *_Test 文件夹。On the target device, open the *_Test folder.

  3. 右键单击 Add-AppDevPackage.ps1 文件。Right-click on the Add-AppDevPackage.ps1 file. 选择使用 PowerShell 运行并按照提示操作。Choose Run with PowerShell and follow the prompts.
    文件资源管理器导航到所示的 PowerShell 脚本File explorer navigated to PowerShell script shown

    已安装应用包,在 PowerShell 窗口将显示此消息:已成功安装了应用。When the app package has been installed, the PowerShell window displays this message: Your app was successfully installed.

    提示

    若要打开平板电脑上的快捷菜单,请触摸要右键单击,按住直到出现完整的圆,然后抬起手指的屏幕。To open the shortcut menu on a tablet, touch the screen where you want to right-click, hold until a complete circle appears, then lift your finger. 快捷菜单将在你抬起手指时打开。The shortcut menu opens once you lift your finger.

  4. 单击“开始”按钮,搜索应用名称,然后启动它。Click the Start button to search for the app by name, and then launch it.