使用 MSIX SDK 将在非 Windows 10 平台上的 MSIX 包分发Use the MSIX SDK to distribute an MSIX package on non-Windows 10 platforms

MSIX SDK 开发人员提供分发到客户端设备,而不考虑客户端设备上的操作系统平台的包内容的通用方法。The MSIX SDK offers developers a universal way to distribute package contents to client devices regardless of the OS platform on the client device. 这使开发人员能够一次而不是让其应用程序内容打包到为每个平台的包。This enables developers to package their app content once instead of having to package for each platform.

若要充分利用 MSIX SDK 和分发到多个平台在包内容的能力,我们提供一种方法来指定想将包解压缩到的目标平台。To take advantage of the MSIX SDK and the ability to distribute your package contents to multiple platforms, we provide a way to specify the target platforms where you want your packages to extract to. 这意味着您可以确保包的内容,从包仅按需提取。This means you can ensure that the package contents are being extracted from the package only as you desire.

下表显示了在清单中声明的目标设备系列。The following table shows the target device families to declare in the manifest.

平台Platform 系列Family 目标设备系列Target Device Family 说明Notes
Windows 10Windows 10 PhonePhone





















Platform.AllPlatform.All























Windows.UniversalWindows.Universal Windows.MobileWindows.Mobile 移动设备Mobile devices
桌面设备Desktop Windows.DesktopWindows.Desktop PCPC
XboxXbox Windows.XboxWindows.Xbox Xbox 控制台Xbox console
Surface HubSurface Hub Windows.TeamWindows.Team 大屏幕 Win 10 设备Large screen Win 10 devices
HoloLensHoloLens Windows.HolographicWindows.Holographic VR/AR 耳机VR/AR headset
IoTIoT Windows.IoTWindows.IoT IoT 设备IoT devices
iOSiOS PhonePhone Apple.Ios.AllApple.Ios.All Apple.Ios.PhoneApple.Ios.Phone iPhone, TouchiPhone, Touch
TabletTablet Apple.Ios.TabletApple.Ios.Tablet iPad mini,iPad,iPad ProiPad mini, iPad, iPad Pro
TVTV Apple.Ios.TVApple.Ios.TV Apple 电视Apple TV
观看Watch Apple.Ios.WatchApple.Ios.Watch iWatchiWatch
MacOSMacOS 桌面设备Desktop Apple.MacOS.AllApple.MacOS.All MacBook Pro,MacBook 以无线方式,Mac Mini iMacMacBook Pro, MacBook Air, Mac Mini, iMac
AndroidAndroid PhonePhone Google.Android.AllGoogle.Android.All Google.Android.PhoneGoogle.Android.Phone 面向任何风格的 Android 的移动设备Mobile devices that target any flavor of Android
TabletTablet Google.Android.TabletGoogle.Android.Tablet Android 平板电脑Android tablets
桌面设备Desktop Google.Android.DesktopGoogle.Android.Desktop ChromebookChromebooks
TVTV Google.Android.TVGoogle.Android.TV Android 大屏幕设备Android large screen devices
观看Watch Google.Android.WatchGoogle.Android.Watch Google 齿轮设备Google gear devices
WindowsWindows 77 Windows7.DesktopWindows7.Desktop Windows 7 设备Windows 7 devices
88 Windows8.DesktopWindows8.Desktop Windows 8/8.1 设备Windows 8/8.1 devices
WebWeb MicrosoftMicrosoft Web.AllWeb.All Web.Edge.AllWeb.Edge.All 边缘 web 引擎应用Edge web engine apps
AndroidAndroid Web.Blink.AllWeb.Blink.All 闪烁 web 引擎应用Blink web engine apps
镶边Chrome Web.Chromium.AllWeb.Chromium.All 引擎的 chrome web 应用Chrome web engine apps
iOSiOS Web.Webkit.AllWeb.Webkit.All Webkit web 引擎应用Webkit web engine apps
MacOSMacOS Web.Safari.AllWeb.Safari.All Safari web 引擎应用Safari web engine apps
LinuxLinux Any/AllAny/All Linux.AllLinux.All 所有 Linux 发行版All Linux distributions

在应用包清单文件中,您将需要包含相应的目标设备系列,如果想要仅在特定平台和设备上提取的包内容。In the app package manifest file, you will need to include the appropriate target device family if you like the package contents to be only extracted on specific platforms and devices. 如果您喜欢 bulid 的方式,它支持所有平台和设备类型的包,请选择Platform.All作为目标设备系列。If you like the bulid the package in such a way that it is supported on all platform and device types, choose Platform.All as the target device family. 同样,如果你想要仅支持 web 应用中的包,选择Web.AllSimilarly, if you like the package to be only supported in web apps, choose Web.All.

示例清单文件 (AppxManifest.xml)Sample manifest file (AppxManifest.xml)

<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
         xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
         xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
         xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3"
         IgnorableNamespaces="mp uap uap3">

  <Identity Name="BestAppExtension"
            Publisher="CN=awesomepublisher"
            Version="1.0.0.0" />

  <mp:PhoneIdentity PhoneProductId="56a6ecda-c215-4864-b097-447edd1f49fe" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>

  <Properties>
    <DisplayName>Best App Extension</DisplayName>
    <PublisherDisplayName>Awesome Publisher</PublisherDisplayName>
    <Description>This is an extension package to my app</Description>
    <Logo>Assets\StoreLogo.png</Logo>
  </Properties>

  <Resources>
    <Resource Language="x-generate"/>
  </Resources>

  <Dependencies>
    <TargetDeviceFamily Name="Platform.All" MinVersion="0.0.0.0" MaxVersionTested="0.0.0.0"/>
  </Dependencies>

  <Applications>
    <Application Id="App">
      <uap:VisualElements
          DisplayName="Best App Extension"
          Description="This is the best app extension"
          BackgroundColor="white"
          Square150x150Logo="images\squareTile-sdk.png"
          Square44x44Logo="images\smallTile-sdk.png"
          AppListEntry="none">
      </uap:VisualElements>

      <Extensions>
        <uap3:Extension Category="Windows.appExtension">
          <uap3:AppExtension Name="add-in-contract" Id="add-in" PublicFolder="Public" DisplayName="Sample Add-in" Description="This is a sample add-in">
            <uap3:Properties>
               <!--Free form space-->
            </uap3:Properties>
          </uap3:AppExtension>
        </uap3:Extension>
      </Extensions>

    </Application>
  </Applications>
</Package>

平台版本Platform version

在上述示例清单文件中,以及平台名称,也有参数,以指定MinVersionMaxVersionTested在 Windows 10 平台上使用这些参数。In the above sample manifest file, along with the platform name, there are also parameters to specify the MinVersion and MaxVersionTested These parameters are used on Windows 10 platforms. 在 Windows 10 中,包将仅部署 Windows 10 操作系统版本大于 MinVersion 上。On Windows 10, the package will only be deployed on Windows 10 OS versions greater than the MinVersion. 在其他非 Windows 10 平台,MinVersion 和 maxversiontested 赋予参数不用于使是否提取包内容的声明。On other non-Windows 10 platforms, the MinVersion and MaxVersionTested parameters aren't used to make the declaration of whether to extract the package contents.

如果你想要使用为所有平台 (Windows 10 和 Windows 10) 的包,我们建议使用 MinVersion 和 maxversiontested 赋予参数来指定你想在应用程序处理 Windows 10 OS 版本。If you would like to use the package for all platforms(Windows 10 and non-Windows 10), we recommend that you use the MinVersion and MaxVersionTested parameters to specify the Windows 10 OS Versions where you would like your app to work. 因此在清单依赖项部分应如下所示:So your manifest's Dependencies section would look like this:

  <Dependencies>
    <TargetDeviceFamily Name="Platform.All" MinVersion="0.0.0.0" MaxVersionTested="0.0.0.0"/>
    <TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.14393.0" MaxVersionTested="10.0.16294.0"/>
  </Dependencies>

MinVersionMaxVersionTested是清单中的必填的字段,它们必须符合四 notation(#.#.#.#)。MinVersion and MaxVersionTested are required fields in the manifest and they need to conform the quad notation(#.#.#.#). 如果您仅使用仅非 Windows 10 平台 MSIX 打包 SDK,可以只需使用"0.0.0.0"作为MinVersionMaxVersionTested作为版本。If you are only using the MSIX packaging SDK for only non-Windows 10 platforms, you can simply use '0.0.0.0' as the MinVersion and MaxVersionTested as the versions.

如何有效地在所有平台 (Windows 10 和 Windows 10) 上使用同一个包How to effectively use the same package on all platforms (Windows 10 and non-Windows 10)

若要充分利用 MSIX 打包 SDK,将需要用于生成包将部署等 Windows 10 上和在同一时间在其他平台上受支持的应用程序包的方式。To make the most of the MSIX Packaging SDK, you will need to build the package in a way that will be deployed like an app package on Windows 10 and at the same time supported on other platforms. 在 Windows 10 中,可以生成将包作为应用扩展On Windows 10, you can build the package as an App Extension. 有关应用扩展以及它们如何帮助使您的应用程序扩展的详细信息,请参阅应用程序扩展插件简介博客文章。For more information about App Extensions and how they can help make your app extensible, see the Introduction to App Extensions blog post.

在本文前面部分所示的清单文件示例,您会注意到属性中的元素AppExtension元素。In the manifest file example shown earlier in this article, you will notice a Properties element within the AppExtension element. 不没有在清单文件的此部分中执行任何验证。There is no validation performed in this section of the manifest file. 这允许开发人员指定之间扩展和主机/客户端应用程序所需元数据。This allows developers to specify the required metadata between extension and host/client app.