RootCommand.ExecutableName Property

Definition

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:

  1. The System.CommandLine.ExecutableName value read from AppContext, when there is no managed entry point (GetEntryAssembly() returns null) - 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's runtimeconfig.json by the System.CommandLine build targets and defaults to the assembly name.
  2. The file name (without extension) of the currently running executable, from GetCommandLineArgs().
  3. The System.CommandLine.ExecutableName value from AppContext, if the executable path was unavailable.
  4. The literal "app", as a final fallback.

Applies to