> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 使用 MSIXVC 工具開始封裝 PC 遊戲

> 使用 MSIXVC 封裝工具開始封裝 PC 遊戲

<Tip>
  **MSIXVC2 自 2026 年 10 月版 GDK 起正式推出。** MSIXVC2 是新一代的 PC 封裝格式，可大幅縮小更新、加快封裝速度，並簡化上傳工作流程。如果您要開始開發新的 PC 遊戲或評估封裝選項，請參閱 [MSIXVC2 封裝概觀](/zh-TW/build/core-features/common/packaging/overviews/packaging-msixvc2-overview)和[開始使用適用於 PC 的 MSIXVC2](/zh-TW/build/core-features/common/packaging/overviews/packaging-getting-started-for-PC-msixvc2)。本頁的步驟適用於原始的 MSIXVC 格式，該格式仍受到完整支援。
</Tip>

使用下列步驟建立 MSIXVC 套件，您可以在目標測試開發 PC 上側載該套件進行測試，然後提交至 Partner Center 進行發佈。

## 檢查 Windows 10 版本的最低需求

MSIXVC 型套件的部署測試需要 Windows 10 版本 18362 或更新版本。

## 評估您的封裝需求

如果您的套件具有下列任何屬性或需要下列任何功能，請參閱本文稍後的[其他封裝考量和進階功能](#other-packaging-considerations-and-advanced-features)一節。

* **架構套件相依性** 如果您的應用程式依賴可轉散發軟體，您可以使用 Microsoft 提供的許多這類必要元件的預先封裝版本，您可以將其宣告為相依性並自動安裝。
* **自訂安裝動作** 如果您的應用程式依賴沒有可用架構套件的可轉散發軟體，您可以鏈結安裝這些相依性。

## 準備您的內容

將遊戲的所有來源素材放在單一目錄中。移除 MSIXVC 封裝系統不支援或不適合在零售套件中發行的任何檔案。

* 程式資料庫 (PDB) 檔案。
* 通用 Windows 平台 (UWP) 和 APPX 足跡檔案，包括 AppxSignature.p7x 和 AppxBlockMap.xml。如果您先前曾以 UWP 形式在 Microsoft Store 中發行，可能會有一些與您的 APPX 或 MSIX 套件相關聯的這類檔案。請移除這些檔案。
* 任何對其他 PC 遊戲商店的參照：資產、二進位檔等。

## 從 Partner Center 取得產品的身分識別資訊

您的套件會參照在 Partner Center 中指派給遊戲的產品身分識別，包括發行者身分識別、PackageFamilyName、MSAAppId 和 TitleId。請設定您的產品，並從 **Game Setup | Identity** 頁面擷取此資訊，以用於您的 MicrosoftGame.config。

1. 如果您尚未這麼做，請[註冊 ID@XBOX 計畫](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/pc-dev/tutorials/pc-e2e-guide/e2e-register-id-at-xbox)並[建立 Partner Center 帳戶](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/pc-dev/tutorials/pc-e2e-guide/e2e-creating-partnercenter-account)。
2. 在 Partner Center 中為您的遊戲[建立初始產品定義](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/pc-dev/tutorials/pc-e2e-guide/e2e-creating-partnercenter-product-definition)。
3. 在產品的 **Game Setup | Identity** 頁面上，找出上面列出的身分識別值。

## 在根資料夾中建立 MicrosoftGame.config XML 檔案，然後建立其餘的遊戲內容

本文稍後包含 MicrosoftGame.config xml 範例檔案。請將此範例與 [MicrosoftGame.config 編輯器](/zh-TW/build/core-features/common/game-config/MicrosoftGameConfig-Editor)搭配作為參考，此編輯器可簡化 .config 檔案的建立，並自動從您的 Partner Center 專案同步 ID 和名稱值。

## 識別任何 Visual C/C++ 執行階段相依性

識別套件的任何 Visual C/C++ 執行階段相依性。請確定它們已在 MicrosoftGame.config 中列為相依性，或已明確複製到套件承載中。如需詳細資訊，請參閱[架構套件相依性](/zh-TW/build/core-features/common/packaging/packaging-framework-packages)。

## 建立要在殼層和市集套件中顯示的圖示

針對下列 MicrosoftGame.config 範例中列出的每個影像，將對應的檔案放在遊戲的根資料夾中，並縮放為指定的大小。或者，將影像資產放在子目錄中，並調整 ShellVisuals 圖示路徑以符合。[MicrosoftGame.config 編輯器](/zh-TW/build/core-features/common/game-config/MicrosoftGameConfig-Editor)可讓您以單一來源影像作為輸入，為您產生這些影像。

## 安裝包含 MakePkg.exe 封裝工具的 Microsoft Game Development Kit

根據預設，Microsoft Game Development Kit (GDK) 命令提示字元位於此資料夾：C:\Program Files (x86)\Microsoft GDK\Command Prompts

## 建立封裝配置對應檔

在包含單一資料夾 (其中有您所有遊戲內容) 的資料夾中開啟 Microsoft Game Development Kit (GDK) 命令提示字元，然後執行下列命令：

`MakePkg genmap /f layout.xml /d <Your_game_folder>`

此命令會建立名為 `layout.xml` 的檔案 (此檔案名稱是建議名稱，但您可以使用任何其他名稱)。請在封裝步驟中使用此檔案。如需封裝工具的詳細資訊，請參閱 [Make package (makepkg.exe)](/zh-TW/build/core-features/common/packaging/deployment/makepkg)。

## 使用 Intelligent Delivery 決定如何縮減安裝大小

若要了解如何在 layout.xml 檔案中標記內容以縮減安裝大小，請參閱 [Intelligent Delivery 概觀](/zh-TW/build/core-features/common/packaging/overviews/intelligentdelivery)。如果您有大量的當地語系化資產，或有不應預設安裝、但應在遊戲觸發時可供下載的內容，請考慮使用 Intelligent Delivery。

## 建立您的套件

使用下列命令建立套件：

`MakePkg pack /f layout.xml /lt /d <Your_game_folder_name> /nogameos /pc /pd <Output_Folder_Name>`

對於依賴授權的案例 (例如遊戲內商店和試用版)，請使用 `makepkg` 搭配實際的內容 ID。Partner Center 會在第一次擷取套件時產生此實際內容 ID。您可以在 **Packages** 頁面上已提交套件的詳細資料中找到它。

## 在目標 PC 上啟用開發人員模式

1. 開啟 **\[設定]**。
2. 在搜尋欄位中輸入 **Developer**。從顯示的選項中，選取 **\[使用開發人員功能]**。
3. 選取 **\[開發人員模式]**。隨即出現對話方塊，表示系統正在新增一些功能。在繼續下一步之前，請等候此程序完成。

## 測試您的應用程式安裝

執行下列命令：`Wdapp install <Your_Package.msixvc>`

套件必須位於開發 PC 的本機磁碟機上，或位於對應至磁碟機代號的網路位置。尚不支援從通用命名慣例 (UNC) 共用進行安裝。如果您沒有看到進度，可以開啟 Microsoft Store 應用程式，並在 **\[下載與更新]** 區段下檢視進度 (如果有的話，此區段以應用程式右上角的向下箭號表示)。您也可以選取省略符號 (...)，然後選取 **\[下載與更新]**。

從 2022 年 3 月版 Microsoft Game Development Kit (GDK) 起，MSIXVC 套件會以平面檔案的形式安裝到 `[drive]:\XboxGames` 資料夾，您可以直接修改和存取這些檔案。您可以使用[應用程式管理 (wdapp.exe)](/zh-TW/tools/tools-pc/commandlinetools/gr-wdapp) 設定此磁碟機位置。如需 Flat File Install 功能的詳細資訊，請參閱 [Flat File Install 概觀](/zh-TW/build/core-features/common/packaging/packaging-flatfileinstall)。

## 準備最終套件，然後將其提交至 Partner Center

您先前使用 [MakePkg.exe](/zh-TW/build/core-features/common/packaging/deployment/makepkg) 命令建立的套件使用了 **/LT** 參數，此參數會使用測試或開發金鑰進行加密。為了獲得最高安全性，請再次執行 MakePkg.exe 命令，並使用 `/LK` 旗標以穩定金鑰加密，或使用 `/L` 旗標以唯一金鑰加密。請使用 `/LK` 而非 `/L`，因為使用 `/LK` 建立的套件可用於本機大小差異比較，並可在提交至 Partner Center 時受益於差異上傳最佳化。

## MicrosoftGame.config 範例

建立名為 MicrosoftGame.config 的檔案。在遊戲內容的根目錄中使用下列內容，然後移除您不需要之項目的註解。

雖然您可以手動建立 MicrosoftGame.config，但建立此檔案的最佳方式是使用 [MicrosoftGame.config 編輯器](/zh-TW/build/core-features/common/game-config/MicrosoftGameConfig-Editor)。此工具也能讓您輕鬆地直接從 Partner Center 專案同步身分識別和 ID 值。

```xml theme={null}
<?xml version="1.0" encoding="utf-8"?>
<Game configVersion="1">
    <!-- Publisher should match the exact value provided in the "Package/Identity/Publisher" field of the Game setup -> Identity section of your product's configuration area in Partner Center.
         Name should match the exact value provided in the "Package/Identity/Name" field of the Game setup -> Identity section of your product's configuration area in Partner Center. -->
    <Identity Name="**REPLACE**"
        Publisher="**REPLACE**"
        Version="1.0.1.0"/>
        <!-- For MSIXVC/MSIXVC2 the fourth digit of the version number is reserved for Microsoft Store use -->

    <!-- These values are found in the Game Setup -> Identity section in your product's configuration area in Partner Center. -->
    <StoreId>**REPLACE WITH STOREID**</StoreId>
    <MSAAppId>**REPLACE WITH MSAAPPID**</MSAAppId>
    <TitleId>**REPLACE WITH TITLEID**</TitleId>

    <!--  Include any additional languages your title supports as appropriate -->
    <Resources>
      <Resource Language="en-US" />
    </Resources>

     <!-- Use override display name if you want to display a different title in the shell than the DefaultDisplayName from the ShellVisuals section, or if you need to localize it. -->

     <!-- Configuring the Alias attribute will allow you to take advantage of Execution Alias functionality when launching your executable. For more information, please see the MicrosoftGame.config reference documentation. -->

    <ExecutableList>
      <Executable Name="**REPLACE**"
                  Id="Game"
                  Alias="**REPLACE**"
                  OverrideDisplayName="**REPLACE**"
                  />
    </ExecutableList>

    <!-- DefaultDisplayName should match the exact value provided in the "Package/Identity/Name" field of the Game setup -> Identity section of your product's configuration area in Partner Center.
         PublisherDisplayName should use the exact value provided in the "Package/Properties/PublisherDisplayName" field of the Game setup -> Identity section of your product's configuration area in Partner Center.-->
    
    <!-- The following asset sizes apply
         StoreLogo - 100x100
         Square150x150Logo - 150x150
         Square44x44Logo - 44x44
         SplashScreenImage - 1920x1080
    -->
    <ShellVisuals DefaultDisplayName="**REPLACE**" 
                  PublisherDisplayName="**REPLACE**"
                  StoreLogo="StoreLogo.png"
                  Square150x150Logo="Logo.png"
                  Square44x44Logo="SmallLogo.png"
                  Description="**REPLACE**"
                  BackgroundColor="#000040"
                  SplashScreenImage="SplashScreen.png"/>
    
    <DesktopRegistration>
      <!-- Include this section if you need to run a custom installer action with Administrator privileges the first time that your game runs.
           Any executable you specify must be located under the "Installers" folder in the base folder of your game. Don't include any other files in the
           Installers folder.
      <CustomInstallActions>
        <Folder>Installers</Folder>
        <InstallActionList>
          <InstallAction File="CustomInstaller.exe" Name="UniqueInstallTaskName" Arguments="/silent /example" />
        </InstallActionList>
      </CustomInstallActions>
      -->
      <DependencyList>
        <!-- Omit the Dependency items if your game doesn't need them, or the entire DependencyList element. Note that your version of VCLibs may be different. See the Framework package dependencies topic of the documentation for details and guidance. -->
        <KnownDependency Name="VC11"/>
      </DependencyList>
        <!-- Select the ProcessorArchitecture that matches your game executables. -->
      <ProcessorArchitecture>x64</ProcessorArchitecture>
      <!--<ProcessorArchitecture>x86</ProcessorArchitecture>-->

      <!-- Include this section if your game uses Xbox services Multiplayer invites.
      <MultiplayerProtocol>true</MultiplayerProtocol>
      -->
    </DesktopRegistration>

    <!-- Include this section if your game writes files to its installation directory, and you're unable to change this by altering your source code and recompiling your game.
    <ExtendedAttributeList>
      <ExtendedAttribute Name="RestrictedCapability" Value="packageWriteRedirectionCompatibilityShim"/>
    </ExtendedAttributeList>
    -->
</Game>
```

## 其他封裝考量和進階功能

### 常見軟體相依性的架構套件

如果您的應用程式依賴某些可轉散發軟體，而該軟體在 Microsoft Store 中以架構套件的形式提供，請宣告對該架構套件的相依性，而不要鏈結安裝可轉散發套件。

例如，如果您的應用程式使用舊版 DirectX 執行階段 (以往是透過[從 Microsoft 下載網站轉散發](https://www.microsoft.com/download/details.aspx?id=35)的 dxsetup.exe 來滿足)，請如下所示，在 Windows.Universal 和 Windows.Desktop 的標準相依性之外，宣告對該架構套件的相依性。這種做法優於使用自訂安裝動作直接安裝可轉散發套件，因為架構套件可透過 Microsoft Store 自動更新，而自訂安裝動作需要系統管理員核准，並會在安裝過程中產生確認提示。

```xml theme={null}
<DependencyList>
  <KnownDependency Name="DX11"/>
</DependencyList>
```

如需已知相依性的完整清單，請參閱 [MicrosoftGame.config 元素 - KnownDependency](/zh-TW/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-knowndependency) 的文件。

在安裝時，作業系統和 Microsoft Store 會確保此套件相依性與您的應用程式一起安裝。如需詳細資訊 (包括 DirectX 和 Visual Studio C/C++ 執行階段架構套件相依性的相關資訊)，請參閱[架構套件相依性](/zh-TW/build/core-features/common/packaging/packaging-framework-packages)。

### Mod 支援

從 2022 年 3 月版 Microsoft Game Development Kit (GDK) 起，預設即支援 Mod。如需詳細資訊，請參閱 [Mod](/zh-TW/build/core-features/common/packaging/packaging-mods)。

### 自訂安裝動作

如果您的應用程式依賴其他必須在安裝應用程式時鏈結安裝的安裝程式 (.exe 或 .msi 檔案)，請使用 CustomInstallActions 元素設定此步驟。

對於可轉散發套件，在決定對 VC 執行階段或 DirectX 可轉散發 .exe 或 .msi 檔案等項目使用自訂安裝程式之前，請先檢查是否有可用的架構套件且其中包含您需要的必要元件。如需自訂安裝動作的詳細指示，請參閱[自訂安裝動作](/zh-TW/build/core-features/common/packaging/packaging-custom-install-actions)。

### 受限制功能權限

除了將 MicrosoftGame.config 檔案設定為包含正確的元素之外，還請寄送電子郵件給您的客戶經理，以啟用權限設定，讓您的遊戲可以使用下列功能。

* 自訂安裝動作 (CustomInstallActions 元素)。

## 相關封裝文章

[MSIXVC2 封裝概觀](/zh-TW/build/core-features/common/packaging/overviews/packaging-msixvc2-overview) [開始使用適用於 PC 的 MSIXVC2](/zh-TW/build/core-features/common/packaging/overviews/packaging-getting-started-for-PC-msixvc2) [開始為 XBOX 主機封裝遊戲](/zh-TW/build/core-features/common/packaging/overviews/packaging-getting-started-for-console) [MicrosoftGame.Config](/zh-TW/build/core-features/common/game-config/MicrosoftGameConfig-toc) [使用 Microsoft Game Development Kit 工具安裝並啟動您的 PC 遊戲](/zh-TW/tools/tools-pc/launching-on-pc) [PC 啟動載入器](/zh-TW/build/gdk-and-engines/guides/pc-bootstrapper)


## Related topics

- [GDK 名詞與縮寫詞彙表](/zh-TW/home/glossary.md)
- [安裝 GDK 工具鏈](/zh-TW/home/setup-install/download-install.md)
- [XBOX 遊戲開發文件](/zh-TW/index.md)
- [從 PC(非 Steam)移植](/zh-TW/paths/porting/from-pc.md)
- [移植總覽](/zh-TW/paths/porting/overview.md)
