語言

RootCommand.ExecutableName 屬性

定義

目前執行檔的名稱。

public:
 static property System::String ^ ExecutableName { System::String ^ get(); };
public static string ExecutableName { get; }
static member ExecutableName : string
Public Shared ReadOnly Property ExecutableName As String

屬性值

備註

名稱的解析順序如下:

  1. 當沒有受管理的入口點(GetEntryAssembly()回傳null)時,從 System.CommandLine.ExecutableName 讀取AppContext的值——最明顯的是當以 NativeAOT 原生函式庫架設時。 GetCommandLineArgs()此時反映的是主機程序,而非該元件。 這個值是由建置目標輸出到應用程式的runtimeconfig.jsonSystem.CommandLine,並預設為組裝名稱。
  2. 目前執行檔的檔名(無副檔名)來自 GetCommandLineArgs()。
  3. 若執行路徑不可用,則為 System.CommandLine.ExecutableName 的 AppContext值。
  4. 字面上的 "app",作為最後的備案。

適用於