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