语言

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. System.CommandLine.ExecutableName从中读取AppContext的值,如果没有托管入口点(GetEntryAssembly()返回null),最明显的是作为 NativeAOT 本机库托管时。 在这种情况下 GetCommandLineArgs() ,反映主机进程,而不是此组件。 该值由System.CommandLine生成目标发出到应用中runtimeconfig.json,默认为程序集名称。
  2. 当前正在运行的可执行文件的文件名(不带扩展名)从 GetCommandLineArgs().
  3. 如果可执行文件路径不可用,则 System.CommandLine.ExecutableName 返回 AppContext的值。
  4. 文本 "app",作为最终回退。

适用于