在 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

  • **應用程式套件 ( msix 或 .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. 由於這項變更,您應該在此編譯環境中測試您的 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 檔案。The app manifest file (Package.appxmanifest) is an XML file that contains the properties and settings required to create your app package. 例如,app 資訊清單檔案中的屬性描述做為您的應用程式磚的影像,以及當使用者旋轉裝置時您的應用程式支援的方向。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. 按兩下 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. 現在您可以決定如何設定您的 app。Now you can decide how to configure your app. 每個索引標籤均包含可設定有關您的 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. 從此處您可以選擇要用來登入您的 app 的憑證。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. 在對您的 app 進行必要的編輯之後,請儲存 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. 若要這樣做,請在方案總管中的專案名稱上按一下滑鼠右鍵,然後選擇 [發佈 -> 應用程式與存放區 (] 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.

注意

如果您想要) 手動建立應用程式套件 ( msix 或 .appx) 或應用 ( 程式套件組合,請參閱 使用 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.

    導覽至 [建立應用程式套件] 的操作功能表

    [ 建立應用程式套件 ] wizard 隨即出現。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.

    顯示選取 App 名稱的 [建立應用程式套件] 視窗

  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. 確定您在 [選取並設定套件] 對話方塊中選取全部的三種架構設定 (x86、x64 及 ARM),以確保 app 部署到最多種類的裝置。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 選項的封裝,並建立合作夥伴中心提交的封裝,則 wizard 會建立封裝上傳 (. .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:

    • 一或多個應用程式套件 ( 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. 選取資料夾內的所有檔案,以滑鼠右鍵按一下檔案,然後選取 [傳送到 -> 壓縮 (壓縮的) 資料夾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 權杖,取得這些工具的詳細資訊,包括下載的位置。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 測試 app 的詳細資訊,請參閱 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 開始,您可以直接從 IDE 將產生的 .appxupload 檔案提交至 Microsoft Store,方法是選取 [建立應用程式套件] wizard結尾的Windows 應用程式認證套件驗證選項之後,自動提交至 Microsoft StoreStarting 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 租使用者識別碼用戶端識別碼用戶端金鑰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. 在此頁面上,複製 [ 租使用者識別碼 ] 和 [ 用戶端識別碼 ] 值。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 租使用者識別碼、用戶端識別碼和用戶端金鑰。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.

確認及發佈進度