Share via


類型中的延伸模組 (: 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>

答案

? 選擇性 (零或一)

屬性和項目

屬性

屬性 描述 資料類型 必要 預設值
類別

應用程式擴充點的類型。

這個屬性可以具有下列其中一個值:

  • windows. fileTypeAssociation
  • windows 通訊協定
  • windows. autoPlayContent
  • windows. autoPlayDevice
  • windows. Windows.sharetarget
  • windows。搜尋
  • windows. fileOpenPicker
  • windows. fileSavePicker
  • windows. cachedFileUpdater
  • windows. contactPicker
  • windows. backgroundTasks
  • windows. cameraSettings
  • windows. accountPictureProvider
  • windows. Windows.search
Yes
EntryPoint

啟動的類別識別碼。

長度介於1到256個字元之間的字串,代表處理延伸模組的工作。 這必須符合 Windows 執行階段類型的完整命名空間名稱。 如果未指定 EntryPoint,則會改用為應用程式定義的進入點。 No
可執行檔

預設啟動可執行檔。

介於1到256個字元之間的字串,其長度必須以 ".exe" 結尾,且不能包含下列字元: < 、 > 、:、%、"、|、?或 *。 它會指定擴充功能的預設可執行檔。 如果未指定,則會使用為應用程式定義的可執行檔。 如果指定的話,也會使用 EntryPoint 屬性。 如果未指定該 EntryPoint 屬性,則會使用為應用程式定義的進入點。 No
>system.runtimetype

執行時間提供者。 當應用程式中有混合的架構時,通常會使用此屬性。

長度介於1到255個字元之間,且不能以句號開頭或結尾,或包含下列字元的字串: < 、 > 、:、%、"、/、\、|、?或 *。 No
StartPage

處理擴充點的網頁

長度介於1到256個字元之間的字串,不能包含下列字元: < 、 > 、:、%、"、|、?或 *。 No

 

子元素

子元素 描述
AutoPlayContent

宣告 autoPlayContent類型的應用程式擴充性點。 應用程式會提供指定的自動播放內容動作。

AutoPlayDevice

宣告 autoPlayDevice類型的應用程式擴充性點。 應用程式會提供指定的自動播放裝置動作。

BackgroundTasks

定義 backgroundTasks類型的應用程式擴充性點。 背景工作會在專用的背景主機中執行;也就是說,沒有 UI。

FileOpenPicker

宣告 fileOpenPicker類型的應用程式擴充性點。 應用程式可讓使用者選擇並開啟指定類型的檔案。

FileSavePicker

宣告 fileSavePicker類型的應用程式擴充性點。 應用程式可讓使用者選擇指定檔案類型的檔案名、副檔名和儲存位置。

FileTypeAssociation

宣告 fileTypeAssociation類型的應用程式擴充性點。 檔案類型關聯表示已註冊應用程式來處理指定之類型的檔案。

通訊協定

宣告類型為 windows. protocol的應用程式擴充性點。 URI 關聯表示已註冊應用程式,以處理具有指定配置的 Uri。

ShareTarget

宣告 windows.sharetarget類型的應用程式擴充點。 應用程式可以共用指定的檔案類型。

 

父項目

Parent 項目 描述
延伸模組 (類型: CT_ApplicationExtensions)

定義應用程式的一個或多個擴充點。

 

下列專案的名稱與這個專案的名稱相同,但內容或屬性不同:

備註

每個應用程式只能宣告這些擴充點一次:

  • windows. accountPictureProvider
  • windows. cachedFileUpdater
  • windows. cameraSettings
  • windows. contactPicker
  • windows. fileOpenPicker
  • windows. fileSavePicker
  • windows. Windows.search
  • windows。搜尋
  • windows. Windows.sharetarget

* * 延伸模組的語義規則: * * 針對任何擴充專案,會在資訊清單 API 中強制執行下列語義規則:

如果指定了/Application/@StartPage,就是使用 JavaScript 和應用程式延伸模組的 Windows 應用程式:

  • 可以是空的
  • 可以只指定 StartPage
  • 可以指定可執行檔和 EntryPoint (選擇性 >system.runtimetype 允許的) ,除非它是 BackgroundTask 延伸模組,在此情況下,它可以省略可執行檔,並預設為 BackgroundTaskHost.exe 可執行檔。

如果未指定/Application/@StartPage,則是使用 c # 或 VB 和 XAML 和應用程式擴充功能的 UWP 應用程式:

  • 可以是空的
  • 可以只指定 StartPage
  • 如果指定了 Executable 或 >system.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