在 Visual Studio 中打包桌面或 UWP 应用Package a desktop or UWP app in Visual Studio

在分发您的应用程序之前,您需要将其打包。Before distributing your app, you need to package it. 本文介绍如何使用 Visual Studio 配置、创建和测试 .MSIX 包。This article describes the process of configuring, creating, and testing an MSIX package using Visual Studio.

应用包类型Types of app packages

  • **应用包 ( 或 .appx) **App Package (.msix or .appx)
    单个包,其中包含应用程序及其资源,面向单个设备体系结构。A single package that contains your application and its resources, targeted at a single device architecture. 例如,x64 或 x86 应用程序包。For example, an x64 or x86 application package. 若要以应用捆绑包为目标,需要为每个体系结构生成一个结构。To target multiple architectures with an app bundle you'd need to generate one for each architecture.

  • **应用捆绑包 ( .msixbundle 或 .appxbundle) **App Bundle (.msixbundle or .appxbundle)
    应用程序包可以包含多个应用包,每个包都构建为支持特定的设备体系结构。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.

  • 应用包上传文件 (. msixupload 或 .appxupload) -仅用于商店提交App Package Upload File (.msixupload or .appxupload) - for Store Submission only
    一个可以包含多个应用包或一个应用程序包以支持各种处理器体系结构的文件。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 一起打包到合作伙伴中心以便发布到 Microsoft Store,则将自动为你创建此文件。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 to the Microsoft Store.

以下是准备和创建应用包的步骤概述: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.

  2. 配置项目Configure your project. 使用 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. 生成应用程序包Generate an app package. 使用 Visual Studio 打包向导来创建应用包。Use the Visual Studio packaging wizard to create an app package.

  4. 运行、调试和测试打包的应用程序Run, debug, and test a packaged application. 通过 Visual Studio 或直接安装包来运行和调试应用程序包。Run and debug your app package from Visual Studio or by installing the package directly.

在打包应用前Before packaging your app

  1. 测试您的应用程序。Test your app. 打包应用程序之前,请确保它在你打算支持的所有设备家族上按预期工作。Before you package your application, 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 (also applies to packaged desktop apps).

  2. 优化你的应用。Optimize your app. 可以使用 Visual Studio 的分析和调试工具来优化打包应用程序的性能。You can use Visual Studio’s profiling and debugging tools to optimize the performance of your packaged application. 例如,用于 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. 默认情况下," 发布 " 生成配置启用 .net native 工具链,因此,请务必使用此 版本 配置来测试应用程序,并检查应用程序的行为是否符合预期。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.

配置项目Configure your project

应用清单文件 (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. 解决方案资源管理器中,展开应用程序项目的项目节点。In Solution Explorer, expand the project node of your application project.

  2. 双击 appxmanifest.xml 文件。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 中的清单设计器

    检查 " 视觉资产 " 选项卡上的应用所需的所有映像。 你将在此处提供 应用图标和徽标Check that you have all the images that are required for an app on the Visual Assets tab. This is where you would provide app icons and logos.

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

    备注

    从 Visual Studio 2019 开始,已打包的桌面或 UWP 项目中不再生成临时证书。Starting in Visual Studio 2019, a temporary certificate is no longer generated in packaged desktop or UWP projects. 若要创建或导出证书,请使用此文中所述的 PowerShell cmdlet。To create or export certificates, use the PowerShell cmdlets described in this article. 在 Visual Studio 的最新版本中,还可以使用存储在用于开发和测试方案的 Azure Key Vault 中的证书对应用进行签名In recent versions of Visual Studio, you can also sign your app with a certificate stored in Azure Key Vault for development and test scenarios.

    重要

    如果你是在 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 installing the app package on your device, you first need to trust the package. 要信任该程序包,必须在用户设备上安装证书。To trust the package, the certificate must be installed on the user's device.

  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. 为此,请在解决方案资源管理器中右键单击项目名称,然后在Publish -> Visual Studio 2019 版本16.3 之前,选择 "发布" "将应用与应用商店" (,"发布" 菜单的名称为 "存储) "。To do this, right-click your project name in Solution Explorer and choose Publish->Associate App with the Store (before Visual Studio 2019 version 16.3, the Publish menu is named 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.

生成应用程序包Generate an app package

可以通过使用 Microsoft Intune 和 Configuration Manager 等应用程序管理工具在网站上发布应用程序,而无需在应用商店中发布应用程序。还可以直接在本地或远程计算机上安装用于测试的 .MSIX 包。Apps can be installed without being published in the Store by publishing them on your Website, using application management tools such as Microsoft Intune and Configuration Manager, etc. You can also directly install an MSIX package for testing on your local or remote machine.

使用打包向导创建应用包Create an app package using the packaging wizard

备注

以下说明和屏幕截图介绍 Visual Studio 2019 版本16.3 中的处理过程。The following instructions and screenshots describe the process as of Visual Studio 2019 version 16.3. 如果使用的是早期版本,则某些 UI 的外观可能会有所不同。If you're using an earlier version, some of the UI might look different. 如果正在打包桌面应用程序,请右键单击 "Windows 应用程序打包项目" 节点。If you're packaging a desktop application, right click on the the Windows Application Packaging Project node.

  1. 解决方案资源管理器中,打开应用程序项目的解决方案。In Solution Explorer, open the solution for your application project.

  2. 右键单击该项目,然后选择 "发布 -> " "创建应用包" (在 Visual Studio 2019 版本16.3 之前,"发布" 菜单的名称为 "存储) 。Right-click the project and choose Publish->Create App Packages (before Visual Studio 2019 version 16.3, the Publish menu is named Store).

    上下文菜单,可导航到“创建应用包”

  3. 在向导的第一页中选择 " 旁加载 ",然后单击 " 下一步"。Select Sideloading in the first page of the wizard and then click Next.

    显示的“创建应用包”对话框窗口

  4. 在 " 选择签名方法 " 页上,选择是跳过打包签名还是选择证书进行签名。On the Select signing method page, select whether to skip packaging signing or select a certificate for signing. 你可以从本地证书存储中选择证书、选择证书文件或创建新证书。You can select a certificate from your local certificate store, select a certificate file, or create a new certificate. 若要将 .MSIX 包安装在最终用户的计算机上,必须使用计算机上受信任的证书对其进行签名。For an MSIX package to be installed on an end user's machine, it must be signed with a cert that is trusted on the machine.

    显示的“创建应用包”对话框窗口

  5. 完成 "使用 Visual Studio 创建应用包上传文件" 部分中所述的 "选择和配置包" 页。Complete the Select and configure packages page as described in the Create your app package upload file using Visual Studio section.

双击安装应用程序包Install your app package by double clicking

只需双击应用包文件即可安装应用程序包。App packages can be installed simply by double clicking the app package file. 为此,请导航到应用包或应用捆绑包文件,然后双击该文件。To do so, 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.

备注

应用安装程序假定已使用设备上受信任的证书对包进行了签名。App Installer assumes that the package was signed with a cert trusted on the device. 如果没有,则需要将签名证书安装到设备上的 "受信任人" 或 "受信任的发行者" 证书颁发机构存储区。If it wasn't, 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.

使用安装脚本安装应用程序包Install your app package using an install script

  1. 打开 *_Test 文件夹。Open the *_Test folder.

  2. 右键单击 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.

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

后续步骤:调试和测试应用程序包Next Steps: Debug and test your app package

有关如何在 Visual Studio 中调试应用程序或使用 Windows 调试工具的详细说明,请参阅 运行、调试和测试应用程序包See Run, debug, and test an app package for how you can debug your application in Visual Studio or using Windows debugging tools.

为应用商店提交生成应用程序包上传文件Generate an app package upload file for Store submission

若要将你的应用分发到 Microsoft Store,我们建议你 ( msixupload 或 .appxupload) 生成一个 应用包上传文件 ,并将此文件提交到合作伙伴中心。To distribute your app to the Microsoft Store, we recommend that you generate an app package upload file (.msixupload or .appxupload) and submit this file 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 instead.

你可以使用 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) 或 () 或 .appxbundle,请参阅 使用 MakeAppx.exe 工具创建应用包If you want to create an app package (.msix or.appx) or app bundle (.msixbundle or .appxbundle) manually, see Create an app package with the MakeAppx.exe tool.

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

备注

以下说明和屏幕截图介绍 Visual Studio 2019 版本16.3 中的处理过程。The following instructions and screenshots describe the process as of Visual Studio 2019 version 16.3. 如果使用的是早期版本,则某些 UI 的外观可能会有所不同。If you're using an earlier version, some of the UI might look different.

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

  2. 右键单击该项目,然后选择 "发布 -> " "创建应用包" (在 Visual Studio 2019 版本16.3 之前,"发布" 菜单的名称为 "存储) 。Right-click the project and choose Publish->Create App Packages (before Visual Studio 2019 version 16.3, the Publish menu is named Store). 如果此选项处于禁用状态或根本没有显示,请检查该项目是否为通用 Windows 项目。If this option is disabled or does not appear at all, check that the project is a Universal Windows project.

    上下文菜单,可导航到“创建应用包”

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

  3. 在第一个对话框中选择 " Microsoft Store ",然后单击 " 下一步"。Select Microsoft Store using a new app name in the first dialog and then click Next.

    显示的“创建应用包”对话框窗口

    如果已将项目与应用商店中的应用相关联,则还可以选择为关联的应用商店应用创建包。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 Sideloading, Visual Studio will not generate the app package upload (.msixupload or .appxupload) file for Partner Center submissions. 如果只想为非存储分发创建 .MSIX 程序包或捆绑包,可以选择此选项。If you only want to create an MSIX packge or bundle for non-Store distribution, then you can select this option.

  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.

    使用显示的应用名称选择创建应用包窗口

  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.

    显示的创建应用包窗口及包配置

  7. 在发布应用后,包括公共符号文件以分析合作伙伴中心的 应用性能Include public 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. 如果你在步骤3中选择了 " 要创建的包" 以上载到 Microsoft Store 选项,并且要为合作伙伴中心提交创建包,则该向导将创建包上传 ( .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.

    显示的程序包创建完成窗口,带有验证选项

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

  1. 将以下文件放在文件夹中:Place the following files in a folder:

    • 一个或多个应用包 ( 或 .appx) 或 ( 或 .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. 选择文件夹中的所有文件,右键单击文件,然后选择 "发送到 -> 压缩 (压缩) 文件夹"。Select all the files within the folder, right-click the files, and select Send to -> Compressed (zipped) folder.

  3. 将新的 zip 文件的扩展名从 .zip 更改为 msixupload 或 .appxupload。Change the new zip file's 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. 可以通过访问 远程计算机上的 RUN .msix applicationss,获取有关这些工具的详细信息,包括下载位置。You can get more information about these tools including where to download them by visiting Run MSIX applicationss 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 开始,你可以通过选择 "创建应用包" 向导末尾的 " Windows 应用程序认证包验证后自动提交到 Microsoft Store " 选项,将生成的 .APPXUPLOAD 文件直接从 IDE 提交到 Microsoft Store。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. 必须将此应用程序分配给 管理员 角色。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. 在 " 创建应用程序包" 向导的末尾,选择 " 自动提交到 Windows 应用认证工具包验证后的 Microsoft Store ,然后单击" 重新配置"。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.

验证和发布进度