RootCommand.ExecutableName 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
目前執行檔的名稱。
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
屬性值
備註
名稱的解析順序如下:
- 當沒有受管理的入口點(GetEntryAssembly()回傳
null)時,從System.CommandLine.ExecutableName讀取AppContext的值——最明顯的是當以 NativeAOT 原生函式庫架設時。 GetCommandLineArgs()此時反映的是主機程序,而非該元件。 這個值是由建置目標輸出到應用程式的runtimeconfig.jsonSystem.CommandLine,並預設為組裝名稱。 - 目前執行檔的檔名(無副檔名)來自 GetCommandLineArgs()。
- 若執行路徑不可用,則為
System.CommandLine.ExecutableName的 AppContext值。 - 字面上的
"app",作為最後的備案。