從任何桌面安裝程式 (MSI、EXE、ClickOnce 或 App-v) 建立 MSIX 套件Create an MSIX package from any desktop installer (MSI, EXE, ClickOnce, or App-V)

您可以使用 MSIX 封裝工具 ,從下列任何選項建立 MSIX 應用程式封裝:You can use the MSIX Packaging Tool to create an MSIX application package from any of the following options:

  • MSIMSI
  • EXEEXE
  • ClickOnceClickOnce
  • App-VApp-V
  • 指令碼Script
  • 手動安裝Manual installation

本檔將逐步引導您瞭解如何取得任何現有的資產,並將其轉換為 MSIX。This doc will walk you through how to take any existing assets you have, and convert them to MSIX.

在開始轉換之前,建議您確定您瞭解您的 安裝程式,以及它是否會轉換。Before you start conversion, we recommend ensuring that you understand your installer, and whether it will convert.

我們也建議您遵循最佳作法,來 設定您的環境MSIX 封裝工具 以進行轉換。We also recommend following the best practices to configure your environment and the MSIX Packaging Tool for conversion.

注意

MSIX 封裝工具目前支援 App-V 5.1。The MSIX Packaging Tool currently supports App-V 5.1. 如果您有使用 App-v 4.x 的套件,建議您使用來源安裝程式轉換成 MSIX。If you have a package with App-V 4.x, we recommend that you use the source installer to convert to MSIX.

第一次啟動工具時,系統會提示您同意傳送遙測資料。When the tool is first launched, you will be prompted to provide consent to sending telemetry data. 請務必注意,您分享的診斷資料只會來自應用程式,而且永遠不會用來識別或連絡您。It's important to note that the diagnostic data you share only comes from the app and is never used to identify or contact you.

建立 應用程式封裝 是最常使用的選項。Creating an application package is the most commonly used option. 您將從安裝程式建立 MSIX 套件,或是手動安裝應用程式裝載。This is where you will create an MSIX package from an installer, or by manual installation of the application payload.

pic1

封裝方法Packaging method

選取轉換電腦的選項:Select an option your conversion machine:

  • 如果您已經在乾淨的環境中工作,請選取 [在這部電腦上建立套件]If you are already working in a clean environment, select Create package on this computer

  • 如果您想要連線到現有的虛擬或遠端電腦,請選取 [在遠端電腦上建立套件]If you want to connect to an existing virtual or remote machine, select Create package on a remote machine

  • 如果您想要轉換的電腦上有本機虛擬機器,請選取 [在本機虛擬機器上建立套件]If you have a local virtual machine on your machine you want to convert on, select Create package on a local virtual machine

    • 請注意,我們只支援 Hyper-v 虛擬機器,如果您想要使用另一個虛擬化產品,您可以使用 [遠端電腦] 選項來連線。Please note that we only support Hyper-V virtual machines, if you want to use another virtualization product you can connect using the remote machine option.
  • [下一步]Click Next

準備電腦Prepare computer

接下來,[準備電腦]**** 頁面會提供準備電腦以進行封裝的選項。Next, the Prepare computer page provides options to prepare the computer for packaging.

需要 MSIX 封裝工具驅動程式 ,如果未啟用,則工具會自動嘗試啟用。The MSIX Packaging Tool Driver is required and the tool will automatically try to enable it if it is not enabled. 工具會先檢查 DISM,查看驅動程式是否已安裝。The tool will first check with DISM to see if the driver is installed. 如果您遇到問題,請嘗試檢查我們的 疑難排解檔,如果問題持續發生,請提出 意見反應中樞的問題If you run into an issue, try checking our troubleshooting documentation, then filing a Feedback Hub issue if the problem persists.

注意

MSIX 封裝工具驅動程式會監視系統,以擷取安裝程式在系統上執行的變更,該系統允許 MSIX 封裝工具根據這些變更來建立套件。The MSIX Packaging Tool Driver monitors the system to capture the changes that an installer is making on the system which allows MSIX Packaging Tool to create a package based on those changes.

Windows Update 為 使用中在封裝期間,我們會暫時停用 Windows Update,因此我們不會收集任何無關的資料。Windows Update is Active We will temporarily disable Windows Update for the duration of packaging so that we don't collect any extraneous data.

  • [擱置重新開機]**** 核取方塊預設為停用。The Pending reboot checkbox is disabled by default. 如果系統提示您擱置的作業需要重新開機,則您必須以手動方式重新啟動機器,然後再次啟動此工具。You'll need to manually restart the machine and then launch the tool again if you are prompted that pending operations need a reboot. 這是建議項目,並非必要。This not required, only recommended.

  • [選用] 如果您選擇停用搜尋服務,請勾選 [Windows Search 正在使用中]**** 的方塊,然後選取 [停用選取項目]****。[Optional] Check the box for Windows Search is Active and select Disable selected if you choose to disable the search service.

    • 這是建議項目,並非必要。This is not required, only recommended.
    • 停用後,此工具會將 [狀態] 欄位更新為 [停用]****。Once disabled, the tool will update the status field to Disabled.
  • 參數核取 [ SMS 主機 ] 的 [作用中] 方塊,如果您選擇停用主機服務,請選取 [ 停用選取 ]。[Optional] Check the box for SMS Host is Active and select Disable selected if you choose to disable the host service.

    • 這是建議項目,並非必要。This is not required, only recommended.
    • 停用後,此工具會將 [狀態] 欄位更新為 [停用]****。Once disabled, the tool will update the status field to Disabled.

完成準備機器後,請按 [下一步]****。When you're done preparing the machine, click Next.

選擇您想要封裝的安裝程式Choose the installer you want to package

您要做的第一件事,就是了解您想要轉換的安裝程式會發生什麼事。The first thing you will want to do is understand what will happen with the installer you wish to convert. 有了這些安裝程式,您可以在這裡指定它們以簡化您的工作流程,也可以在稍後於工作流程中安裝時手動執行它。With any of these installers, you can specify them here to simplify your workflow, or you can manually run it at the time of installation later in the workflow.

MSI 安裝程式MSI installers

如果您要轉換 .msi 安裝程式,您可以直接流覽它,並指定 .msi。If you are converting a .msi installer, you can simply browse for it, and specify the .msi. 如果您有隨附的 .mst 或 .msp 檔,您可以在 [安裝程式引數] 欄位中指定它。If you have an accompanying .mst or .msp file, you can specify that in the installer arguments field. 在這裡指定 .msi 的優點之一,就是我們可以提取所有的封裝資訊,節省您在下一步轉換的時間。One of the benefits of specifying your .msi here is that we can pull all of the package information from it, saving you time on the next step of conversion.

App-v 安裝程式App-V installers

如果您是使用 App-v 進行轉換,則這是相當簡單的程式。If you are converting using an App-V, this is a really simple process for you. 您只需要指定 App-v 檔案,就可以快速追蹤到 [建立 MSIX] 頁面。All you need to do is specify an App-V file, and you get fast tracked to the create an MSIX page. 這是因為封裝的資訊清單只需要轉譯成 MSIX 套件,然後就能作為 MSIX。This is because the manifest of the package simply needs to get translated to an MSIX package, and then it just works as an MSIX. 這裡要注意的是,此工具只支援 App-v 5.1-如果您的 App-v 是2.x 版,建議您採用來源安裝程式,然後將它直接轉換成 MSIX。The caveat here is that the tool only supports App-V 5.1 - if your App-V is version 4.x, we recommend that you take the source installer and then convert it directly to MSIX.

EXE 安裝程式EXE installers

如果您要轉換 .exe 安裝程式,您可以在此時指定安裝程式。If you are converting a .exe installer, you can specify the installer at this point. 由於與 exe 缺乏格式一致性,您必須手動輸入安裝程式的套件資訊。Due to the lack of format consistency with an exe, you will need to manually enter the package information for your installer.

ClickOnce 安裝程式ClickOnce installers

如果您要轉換 ClickOnce 安裝程式,您可以在此時指定安裝程式。If you are converting a ClickOnce installer, you can specify the installer at this point. 就像 .exe 一樣,您必須手動輸入安裝程式的套件資訊。Like an .exe, you will need to manually enter the package information for your installer.

指令碼Scripts

如果您使用腳本來安裝應用程式,您可以在這裡指定命令列。If you are using a script to install your application, you can specify the command line here. 或者,您可以將此欄位保留空白,並在 安裝階段手動執行腳本。Alternatively, you can leave this field blank and run the script manually during the installation phase.

手動安裝Manual installation

如果您想要手動執行安裝程式,或手動執行安裝程式的動作,您可以將安裝程式欄位保留空白,並在 安裝階段執行安裝程式所需的動作。If you wish to manually run your installer, or perform the actions of the installer manually, you can leave the installer field blank, and during the installation phase, perform the actions required for your installer.

如果您嘗試產生轉換範本檔案,您將無法在未指定安裝程式的情況下進行。If you are trying to generate a conversion template file, you will be unable to do so without specifying an installer.

如果您有任何安裝程式引數,您可以在提供的欄位中輸入所需的引數。If you have any installer arguments, you can enter the desired argument in the provided field. 此欄位可接受任何字串。This field accepts any string.

簽署喜好設定Signing preference

在 [ 簽署喜好設定] 下,選取簽署選項。Under Signing preference, select a signing option. 您也可以在設定中將此設為預設值,這會在您每次轉換時節省一些步驟。You can also set this as a default in your settings, which will save you some steps each time you convert.

  • 使用 Device Guard 簽署簽署 此選項可讓您登入已設定為與 Device Guard 簽署搭配使用的 Microsoft Active Directory 帳戶,也就是 Microsoft 提供的簽署服務,讓您不需要提供自己的憑證。Sign with Device Guard signing This option allows you to sign in to your Microsoft Active Directory account that you have configured to use with Device Guard signing, which is a signing service that Microsoft provides where you don't need to provide your own certificate. 您可以 在這裡深入瞭解如何設定您的帳戶及 Device Guard 簽署。Learn more about how to set up your account and about Device Guard signing here.
  • **使用憑證簽署 ( .pfx) ** 流覽並選取您的 .pfx 憑證檔案。Sign with a certificate(.pfx) Browse to and select your .pfx certificate file. 如果憑證受到密碼保護,請在 [密碼] 方塊中輸入密碼。If the certificate is password protected, type the password in the password box.
  • **指定 .cer 檔案 (不會簽署) ** 此選項可讓您指定 .cer 檔案。Specify a .cer file (does not sign) This option allows you to specify a .cer file. 當您不想簽署封裝,但想要確保發行者資訊符合將用於簽署之憑證的主體時,這會很有用。This is useful when you don't want to sign the package, but you want to ensure that the publisher information matches the subject of the certificate that will be used for signing.
  • 不要簽署套件 如果您稍後將簽署套件,請選取此選項。Do not sign package Select this option if you will be signing your package at a later time. 注意:如果未簽署 MSIX 套件,則無法安裝該套件NOTE: You cannot install an MSIX package if it is not signed
  • 簽署時,強烈建議您將 時間戳記 新增至您的憑證,讓憑證的有效性能夠 outlast 其到期日。When signing, we highly recommend adding a timestamp to your certificate so that the validity of your certificate can outlast its expiration date. 接受的格式為 RFC 3161 時間戳記伺服器 URLThe accepted format is an RFC 3161 time stamp server URL.

注意

不支援使用 SHA1 憑證簽署 MSIX 套件格式應用程式。Signing an MSIX package format application with a SHA1 certificate is not supported.

按 [下一步] 繼續進行。Click Next to proceed.

套件資訊Package information

當您選擇在現有虛擬機器上封裝應用程式之後,您必須提供應用程式的相關資訊。After you choose to package your application on an existing virtual machine, you must provide information about to the app. 此工具會根據安裝程式中的可用資訊,嘗試自動填入這些欄位。The tool will try to auto-fill these fields based on the information available from the installer. 您一律可以根據需求來更新項目。You will always have a choice to update the entries as needed. 如果欄位以星號 * 標示,表示是必填項目。If the field as an asterisk*, it's required. 如果項目無效,則會提供內嵌說明。Inline help is provided if the entry is not valid.

  • 套件名稱:Package name:
    • 這是必要項目,而且必須對應到資訊清單中的套件識別名稱,以描述套件內容。Required and corresponds to package identity Name in the manifest to describe the contents of the package.
    • 不會顯示給終端使用者。Is not shown to the end user.
    • 會區分大小寫,而且不能有空格。Is case-sensitive and cannot have a space.
    • 可接受介於 3 到 50 個字元的字串,其中可包含英數字元、英文句點和破折號字元。Can accept string between 3 and 50 characters in length that consists of alpha-numeric, period, and dash characters.
    • 不能以句號結尾,而且必須是下列其中一項: "CON"、"PRN"、"AUX"、"NUL"、"COM1"、"COM2"、"COM3"、"COM4"、"COM5"、"COM6"、"COM7"、"COM8"、"COM9"、"LPT1"、"LPT2"、"LPT3"、"LPT4"、"LPT5"、"LPT6"、"LPT7"、"LPT8" 和 "LPT9"。Cannot end with a period and be one of these: "CON", "PRN", "AUX", "NUL", "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9", "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", and "LPT9."
  • 套件顯示名稱:Package display name:
    • 這是必要項目,而且必須對應到資訊清單中的套件,以在開始功能表及設定頁面中向使用者顯示易記的套件名稱。Required and corresponds to package in the manifest to display a friendly package name to the user, in start menu and settings pages.
    • 欄位可接受介於 1 到 256 個字元的單一字串,並且可當地語系化。Field accepts A string between 1 and 256 characters in length and is localizable.
  • 發行者名稱:Publisher name:
    • 這是必要項目,而且必須對應到描述發行者資訊的套件。Required and corresponds to package that describes the publisher information.
    • 發行者屬性必須符合簽署套件所用憑證的發行者主體資訊。The Publisher attribute must match the publisher subject information of the certificate used to sign a package.
    • 此欄位接受介於 1 到 8192 個字元的字串,且需符合辨別名稱的規則運算式:"(CN | L | O | OU | E | C | S | STREET | T | G | I | SN | DC | SERIALNUMBER | Description | PostalCode | POBox | Phone | X21Address | dnQualifier | (OID.(0 | [1-9][0-9])(.(0 | [1-9][0-9]))+))=(([^,+="<>#;])+ | ".")(, ((CN | L | O | OU | E | C | S | STREET | T | G | I | SN | DC | SERIALNUMBER | Description | PostalCode | POBox | Phone | X21Address | dnQualifier | (OID.(0 | [1-9][0-9])(.(0 | [1-9][0-9]))+))=(([^,+="<>#;])+ | ".")))*"。This field accepts a string between 1 and 8192 characters in length that fits the regular expression of a distinguished name : "(CN | L | O | OU | E | C | S | STREET | T | G | I | SN | DC | SERIALNUMBER | Description | PostalCode | POBox | Phone | X21Address | dnQualifier | (OID.(0 | [1-9][0-9])(.(0 | [1-9][0-9]))+))=(([^,+="<>#;])+ | ".")(, ((CN | L | O | OU | E | C | S | STREET | T | G | I | SN | DC | SERIALNUMBER | Description | PostalCode | POBox | Phone | X21Address | dnQualifier | (OID.(0 | [1-9][0-9])(.(0 | [1-9][0-9]))+))=(([^,+="<>#;])+ | ".")))*".
  • 發行者顯示名稱:Publisher display name:
    • 這是必要項目,而且必須對應到資訊清單中的套件,以在應用程式安裝程式及設定頁面中向使用者顯示易記的發行者名稱。Required and corresponds to package in the manifest to display a friendly publisher name to the user, in App installer and settings pages.
    • 欄位可接受介於 1 到 256 個字元的單一字串,並且可當地語系化。Field accepts A string between 1 and 256 characters in length and is localizable.
  • 版本:Version:
    • 這是必要項目,而且必須對應到資訊清單中的套件,以描述套件的版本號碼。Required and corresponds to the package in the manifest to describe the version number of the package.
    • 此欄位接受四個標記法中的版本字串:「主要。This field accepts a version string in quad notation: "Major.Minor.Build.Revision".
  • 描述:Description:
    • 此為選擇性欄位。This field is optional.
  • 安裝位置:Install location:
    • 這是安裝程式要將應用程式承載複製過去的位置 (通常是 Programs Files 資料夾)。This is the location that the installer is going to copy the application payload to (usually Programs Files folder).
    • 此欄位是選擇性欄位,但建議在將應用程式承載安裝在 Program Files 資料夾之外時使用。This field is optional but recommended when the app payload is being installed outside of the Program Files folders.
    • 瀏覽並選取資料夾路徑。Browse to and select a folder path.
    • 當您進行應用程式安裝作業時,請確定此檔案符合安裝程式的安裝位置。Make sure this file matches the installer's install location while you go through the application install operation.
  • 將 MSIX Core 的支援新增至此套件。Add support for MSIX Core to this package.
    • 若選取此核取方塊,則會顯示下拉式清單,aloow 您針對所產生的封裝選取 Windows 版本以 MSIX 核心 支援。When selected, this checkbox will then reveal a drop down that will aloow you to select a Windows version for MSIX Core support for the package you are generating.

安裝Installation

  • 這是工具監視和捕獲應用程式安裝作業的安裝階段。This is the installation phase where the tool is monitoring and capturing the application install operations.
  • 此工具將會在先前指定的環境中啟動安裝程式,而您必須透過安裝程式嚮導來安裝應用程式。The tool will launch the installer in the environment that was specified previously and you'll need to go through the installer wizard to install the application.
    • 請確定安裝路徑符合稍早在 [套件資訊] 頁面中定義的內容。Make sure the installation path matches what was defined earlier in the package information page.
    • 您可能需要在 desktop 中為新安裝的應用程式建立快捷方式。You might need to create a shortcut in desktop for the newly installed application.
    • 透過應用程式安裝精靈完成作業後,請確定您已完成或關閉安裝精靈。Once you're done with the application installation wizard, make sure you finish or close on the installation wizard.
    • 如果您需要執行多個安裝程式,可以在此時手動執行此操作。If you need to run multiple installers you can do that manually at this point.
    • 如果應用程式需要其他必要條件,您必須立即安裝。If the app needs other pre-requisites, you need to install them now.
    • 如果應用程式需要 .Net 3.5/20,請將此選用功能新增至 Windows。If the application needs .Net 3.5/20, add the optional feature to Windows.
  • 如果您先前未指定安裝程式,您可以在這裡手動執行安裝程式或腳本。If you did not specify an installer previously, here is where you can manually run your installer or script.
  • 如果您的 安裝程式需要重新啟動,您可以執行手動重新開機,或使用 [重新開機] 按鈕來執行重新開機,而在重新開機後,您會回到轉換程式中的這個點。If your installer requires a restart, you can perform a manual restart, or use the 'restart' button to perform the restart, and you will return to this point in the conversion process after the restart.
  • 完成應用程式安裝時,請按 [下一步]****。When you've completed installing the application, click Next.

管理第一個啟動工作Manage first launch tasks

此頁面會顯示工具擷取的應用程式可執行檔。This page shows application executables that the tool captured. 我們建議您啟動應用程式至少一次,以擷取所有的第一個啟動工作。We recommended launching the application at least once to capture any first launch tasks.

您可以藉由選取可執行檔,然後按一下 [ 執行] 來啟動該可執行檔。You can launch the executable by selecting it, and then clicking run. 您也可以選取任何不必要的進入點,然後按一下 [ 移除] 來移除它。You can also remove any unnecessary entry points by selecting it, and then clicking remove.

如果有多個應用程式,請勾選對應至主要進入點的方塊。If there are multiple applications, check the box that corresponds to the main entry point. 如果您在此沒有看到應用程式 .exe,請手動瀏覽至可執行檔並加以執行。If you don't see the application .exe here, manually browse to and run it. 然後,重新整理 清單Then, refresh list.

按 [下一步]**** 系統會跳出提示,要求您確認已完成應用程式安裝並管理第一個啟動工作。Click Next You'll be prompted with a pop up asking for confirmation that you're finished with application installation and managing first launch tasks.

  • 如果您已完成,請按一下 [是,繼續]****。If you're done, click Yes, move on.
  • 如果您未完成,請按一下 [否,我尚未完成]****。If you're not done, click No, I'm not done. 您將會返回上一頁,以在其中啟動應用程式,以及安裝或複製其他檔案和 dll/可執行檔。You'll be taken back to the last page to where you can launch applications, install or copy other files, and dlls/executables.

服務報告Services report

從1.2019.1220.0 版本的 MSIX 封裝工具開始,您可以使用服務來轉換 安裝程式,因此我們新增了 [服務報告] 頁面。Starting in the 1.2019.1220.0 version of the MSIX Packaging Tool, you can convert an installer with services, and so we've added a Services report page. 如果未偵測到任何服務,您仍然會看到此頁面,但在頁面頂端沒有偵測到任何服務的訊息會是空的。If no services were detected, you will still see this page, but it will be empty with a message that no services were detected at the top of the page.

[服務報告] 頁面會列出在轉換期間于安裝程式中偵測到的服務。The Services report page lists services that were detected in your installer during conversion. 內含的表格中將會顯示擁有所需且受支援之所有資訊的服務。Services that have all the information they need and are supported will be shown in the Included table. 排除的表格中將會顯示需要其他資訊、需要修正或不支援的服務。Services that need additional information, need a fix, or aren’t supported will be shown in the Excluded table.

若要修正服務或查看與服務有關的其他資料,請按兩下資料表中的服務專案,以查看具有服務詳細資訊的快顯視窗。To fix a service or see additional data about the service, double-click the service entry in the table to view a pop-up with more information about the service. 您可以視需要編輯這部分資訊。You can edit some of this information if you need to.

  • 索引鍵名稱: 服務的名稱。Key name: The name of the service. 這是不可編輯的。This is not editable.
  • 描述: 服務專案的描述。Description: The description of the service entry.
  • 顯示名稱: 服務的顯示名稱。Display name: The display name of the service.
  • 映射路徑: 服務可執行檔的位置。Image path: Location of the service executable. 這是不可編輯的。This is not editable.
  • 啟動帳戶: 服務的啟動帳戶。Start account: The start account for the service.
  • 啟動類型: 服務的啟動類型。Startup type: Type of startup for the service. 支援 自動手動停用Supports Automatic, Manual, and Disabled.
  • 引數: 當服務啟動時要執行的引數。Arguments: Arguments to be run when the service starts.
  • 相依性 服務的相依性。Dependencies: Dependencies for the service.

修正服務之後,您可以將它移到 包含 的資料表,或者,如果您不想要將它放在您的最終封裝中,可以選擇將它保留在 排除 的資料表中。After a service has been fixed, you can move it to the Included table or you can choose to leave it in the Excluded table if you don’t want it in your final package. 如需詳細資訊,請參閱 服務檔For additional information, check out the services documentation.

建立套件Create package

  • 提供儲存 MSIX 套件的位置。Provide a location to save the MSIX package.
  • 根據預設,套件會儲存在本機的 app data 資料夾。By default, packages are saved in local app data folder.
  • 您可以在 [設定] 功能表中定義預設儲存位置。You can define the default save location in Settings menu.
  • 如果您要產生轉換範本檔案,也可以為該範本檔案指定不同的儲存位置,如果您不想要與 MSIX 套件位於相同的位置。If you are generating a conversion template file, you can also specify a different save location for that template file if you don't want it in the same location as the MSIX package.
  • 如果您想要在儲存 MSIX 封裝之前,繼續編輯封裝的內容和屬性,您可以選取 [ 封裝編輯器 ],然後將其移至封裝編輯器。If you'd like to continue to edit the content and properties of the package before saving the MSIX package, you can select Package editor and be taken to package editor.
  • 按一下 [建立]**** 來建立 MSIX 套件。Click Create to create the MSIX package.

當封裝建立時,您會看到快顯視窗。You'll be presented with a pop up when the package is created. 這個快顯視窗會包含儲存位置,並連結到新建立之封裝的檔案位置。This pop up will include the save location, linked to the file location of the newly created package. 它也包含 MSIX 封裝工具之記錄檔位置的連結。It also includes a link to the location of the log files for the MSIX Packaging Tool. 您可以關閉此快顯視窗並重新導向至歡迎頁面。You can close this pop up and get redirected to the welcome page. 您也可以選取 [ 封裝編輯器 ] 來查看和修改套件內容和屬性。You can also select Package editor to see and modify the package content and properties.