RootCommand.ExecutableName Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
The name of the currently running executable.
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
Property Value
Remarks
The name is resolved in the following order:
- The
System.CommandLine.ExecutableNamevalue read from AppContext, when there is no managed entry point (GetEntryAssembly() returnsnull) - most notably when hosted as a NativeAOT native library. In that case GetCommandLineArgs() reflects the host process rather than this component. The value is emitted into the app'sruntimeconfig.jsonby theSystem.CommandLinebuild targets and defaults to the assembly name. - The file name (without extension) of the currently running executable, from GetCommandLineArgs().
- The
System.CommandLine.ExecutableNamevalue from AppContext, if the executable path was unavailable. - The literal
"app", as a final fallback.