类型中的扩展 (: CT_ApplicationExtensions)

声明应用的扩展点。

元素层次结构

<包>
<应用程序>
<应用程序>
<扩展>
<分机>

语法

<Extension Category     = "windows.fileTypeAssociation" | "windows.protocol" | "windows.autoPlayContent" | "windows.autoPlayDevice" | "windows.shareTarget" | ...
           Executable?  = A string between 1 and 256 characters in length that must end with ".exe" and cannot contain these characters: <, >, :, %, ", |, ?, or *. It specifies the default executable for the extension. If not specified, the executable defined for the app is used.  If specified, the EntryPoint property is also used. If that EntryPoint property isn't specified, the EntryPoint defined for the app is used.
           EntryPoint?  = A string between 1 and 256 characters in length, representing the task  handling the extension. This is normally the fully namespace-qualified name of a Windows Runtime type.
If EntryPoint is not specified, the EntryPoint defined for the app is used instead.

           RuntimeType? = A string between 1 and 255 characters in length that cannot start or end with a period or contain these characters: <, >, :, %, ", /, \, |, ?, or *.
           StartPage?   = A string between 1 and 256 characters in length that cannot contain these characters: <, >, :, %, ", |, ?, or *. >

  <!-- Child elements -->
  ( FileTypeAssociation
  | Protocol
  | AutoPlayContent
  | AutoPlayDevice
  | ShareTarget
  | FileOpenPicker
  | FileSavePicker
  | BackgroundTasks
  )?

</Extension>

? 可选 (零个或一个)

特性和元素

特性

属性 说明 数据类型 必须 默认值
类别

应用扩展点的类型。

此属性可以具有以下值之一:

  • fileTypeAssociation
  • windows 协议
  • autoPlayContent
  • autoPlayDevice
  • shareTarget
  • windows。搜索
  • fileOpenPicker
  • fileSavePicker
  • cachedFileUpdater
  • Windows.contactpicker
  • backgroundTasks
  • cameraSettings
  • accountPictureProvider
  • printTaskSettings
EntryPoint

可激活类 ID。

长度介于1到256个字符之间的字符串,表示处理扩展插件的任务。 这通常是 Windows 运行时类型的完全命名空间限定名称。 如果未指定 EntryPoint,则改用为应用定义的入口点。
可执行文件

默认启动可执行文件。

长度介于1到256个字符之间的字符串,必须以 ".exe" 结尾,不能包含以下字符: < 、 > 、:、%、"、|、?或 *。 它指定扩展的默认可执行文件。 如果未指定,则使用为应用定义的可执行文件。 如果已指定,则还使用 EntryPoint 属性。 如果未指定入口点属性,则使用为应用定义的入口点。
RuntimeType

运行时提供程序。 在应用中存在混合框架时,通常使用此属性。

长度介于1到255个字符之间的字符串,不能以句点开头或结尾,也不能包含以下字符: < 、 > 、:、%、"、/、\、|、?或 *。
StartPage

处理扩展点的网页。

长度为1到256个字符且不能包含以下字符的字符串: < 、 > 、:、%、"、|、?或 *。

 

子元素

子元素 说明
AutoPlayContent

声明 autoPlayContent类型的应用可扩展性点。 应用提供指定的自动播放内容操作。

AutoPlayDevice

声明 autoPlayDevice类型的应用可扩展性点。 应用提供指定的自动播放设备操作。

BackgroundTasks

定义 backgroundTasks类型的应用可扩展性点。 后台任务在专用的后台主机上运行;也就是说,无需用户界面。

FileOpenPicker

声明 fileOpenPicker类型的应用可扩展性点。 应用使用户可以选择并打开指定类型的文件。

FileSavePicker

声明 fileSavePicker类型的应用可扩展性点。 应用允许用户为指定的文件类型选择文件名、扩展名和存储位置。

FileTypeAssociation

声明 fileTypeAssociation类型的应用可扩展性点。 文件类型关联指示已注册应用程序以处理指定类型的文件。

协议

声明类型为 windows的应用扩展性点。 URI 关联指示已注册应用程序以使用指定的方案来处理 Uri。

ShareTarget

声明 shareTarget类型的应用程序扩展点。 应用可以共享指定的文件类型。

 

父元素

父元素 说明
扩展 (类型: CT_ApplicationExtensions)

定义应用程序的一个或多个扩展点。

 

以下元素具有与此相同的名称,但内容或属性不同:

备注

只能为每个应用声明一次这些扩展点:

  • accountPictureProvider
  • cachedFileUpdater
  • cameraSettings
  • Windows.contactpicker
  • fileOpenPicker
  • fileSavePicker
  • printTaskSettings
  • windows。搜索
  • shareTarget

* * 有关扩展的语义规则: * * 对于任何扩展元素,在清单 API 中强制实施以下语义规则:

如果 @StartPage 指定了/Application/,则它是使用 JavaScript 和应用扩展的 Windows 应用:

  • 可为空
  • 只能指定 StartPage
  • 可指定可执行文件和入口点 (允许的) 可选 RuntimeType,除非它是 BackgroundTask 扩展,在这种情况下,它可以省略可执行文件并将其默认设置为 BackgroundTaskHost.exe 可执行文件。

如果未指定/Application/@StartPage,则它是一个使用 c # 或 VB、XAML 和应用扩展的 UWP 应用:

  • 可为空
  • 只能指定 StartPage
  • 如果指定了 Executable 或 RuntimeType,则必须指定 EntryPoint。

示例

下面的示例摘自其中一个 SDK 示例的包清单。

<Applications>
  <Application Id="App" StartPage="default.html">
    <VisualElements DisplayName="Assocation launching sample" 
         Logo="images\squareTile-sdk.png" SmallLogo="images\smallTile-sdk.png" 
         Description="SDK sample" 
         ForegroundText="dark" BackgroundColor="#FFFFFF" ToastCapable="false">
      <DefaultTile ShowName="allLogos" />
      <SplashScreen BackgroundColor="white" Image="images\splash-sdk.png" />
    </VisualElements>
    <Extensions>
      <Extension Category="windows.fileTypeAssociation">
        <FileTypeAssociation Name=".alsdkjs">
          <SupportedFileTypes>
            <FileType>.alsdkjs</FileType>
          </SupportedFileTypes>
        </FileTypeAssociation>
      </Extension>
      <Extension Category="windows.protocol">
        <Protocol Name="alsdkjs" />
      </Extension>
    </Extensions>
  </Application>
</Applications>

请参阅

概念应用协定和扩展

要求

Namespace http://schemas.microsoft.com/appx/2010/manifest