語言

<entryPoint> element (ClickOnce 應用程式)

識別當此 ClickOnce 應用程式在用戶端電腦執行時應執行的組合語言。

語法

<entryPoint
   name
>
   <assemblyIdentity
      name
      version
      processorArchitecture
      language
   />
   <commandLine
      file
      parameters
   />
   <customHostRequired />
   <customUX />
</entryPoint>

元素和屬性

該 entryPoint 元素是必填且位於命名空間中 urn:schemas-microsoft-com:asm.v2 。 應用程式清單中可能只定義一個 entryPoint 元素。

該 entryPoint 元素具有以下屬性。

Attribute Description
name Optional. 這個值不會被 .NET Framework 使用。

entryPoint 具有以下元素。

assemblyIdentity

Required. 其 assemblyIdentity 角色及其屬性定義於 <assemblyIdentity> Element。

processorArchitecture此元素的屬性與processorArchitecture應用程式清單其他處定義assemblyIdentity的屬性必須相符。

命令列

Required. 一定是元素之 entryPoint 子。 它沒有子元素,並具備以下屬性。

Attribute Description
file Required. 這是 ClickOnce 應用程式啟動組件的本地參考。 此值不能包含前斜線(/)或反斜線(\)路徑分隔符。
parameters Required. 描述進入點應採取的行動。 唯一有效的值為 run;若提供空白字串, run 則假設為 。

customHostRequired(需要)

Optional. 若包含,則指定此部署包含一個將部署於自訂主機內的元件,且非獨立應用程式。

若此元素存在,則 assemblyIdentity 和 commandLine 元素必然不同時存在。 如果是,ClickOnce 會在安裝時產生驗證錯誤。

這個元素沒有屬性,也沒有子元素。

自訂使用者體驗

Optional. 指定該應用程式由自訂安裝程式安裝與維護,且不建立開始選單項目、捷徑或新增/移除程式項目。

<customUX xmlns="urn:schemas-microsoft-com:clickonce.v1" />

包含 customUX 元素的應用程式必須提供一個自訂安裝程式,使用該 InPlaceHostingManager 類別來執行安裝操作。 包含此元素的應用程式無法透過雙擊其清單或 setup.exe 前置啟動工具來安裝。 自訂安裝程式可以建立開始選單的項目、捷徑以及新增或移除程式的項目。 如果自訂安裝程式沒有建立新增或移除程式的項目,它必須儲存該屬性所 SubscriptionIdentity 提供的訂閱識別碼,並允許使用者透過呼叫 UninstallCustomUXApplication 該方法來卸載應用程式。 欲了解更多資訊,請參閱 攻略:為 ClickOnce 應用程式建立自訂安裝程式。

備註

此元素用以識別 ClickOnce 應用程式的組裝與入口點。

執行時不能用它 commandLine 把參數傳入應用程式。 你可以從應用程式的 AppDomain. 欲了解更多資訊,請參閱 「如何:在線上 ClickOnce 應用程式中取得查詢字串資訊」。

Example

以下程式碼範例說明了 ClickOnce 應用程式清單中的一個 entryPoint 元素。 此程式碼範例是 ClickOnce 應用程式清單 主題中較大範例的一部分。

<!-- Identify the main code entrypoint. -->
<!-- This code runs the main method in an executable assembly. -->
  <entryPoint>
    <assemblyIdentity
      name="MyApplication"
      version="1.0.0.0"
      language="neutral"
      processorArchitecture="x86" />
    <commandLine file="MyApplication.exe" parameters="" />
  </entryPoint>

參見