diff --git a/src/Aspire.Cli/Commands/DoCommand.cs b/src/Aspire.Cli/Commands/DoCommand.cs
index 51922787000..ce14ce8b2a5 100644
--- a/src/Aspire.Cli/Commands/DoCommand.cs
+++ b/src/Aspire.Cli/Commands/DoCommand.cs
@@ -35,9 +35,29 @@ public DoCommand(IDotNetCliRunner runner, IInteractionService interactionService
{
var step = result.GetValue(_stepArgument);
var listSteps = result.GetValue(s_listStepsOption);
- if (string.IsNullOrEmpty(step) && !listSteps && !ExtensionHelper.IsExtensionHost(interactionService, out _, out _))
+ if (!string.IsNullOrEmpty(step))
{
- result.AddError("The 'step' argument is required when not using --list-steps.");
+ return;
+ }
+
+ if (listSteps)
+ {
+ // `aspire do --list-steps` with no step has no meaningful scope: the listing for
+ // `do` is always relative to a target step. Surface a friendly error pointing at
+ // common starting steps and the docs rather than launching the AppHost and
+ // crashing mid-pipeline (see https://github.com/microsoft/aspire/issues/17526).
+ // This applies in the extension host too because `--list-steps` does not flow
+ // through the interactive step prompt in GetRunArgumentsAsync, so without this
+ // error the extension would still hit the original crash path.
+ result.AddError(DoCommandStrings.ListStepsRequiresStep);
+ return;
+ }
+
+ // For a plain `aspire do` invocation, the extension host prompts the user for a step
+ // later in GetRunArgumentsAsync, so don't add a validation error there.
+ if (!ExtensionHelper.IsExtensionHost(interactionService, out _, out _))
+ {
+ result.AddError(DoCommandStrings.StepArgumentRequired);
}
});
}
diff --git a/src/Aspire.Cli/Resources/DoCommandStrings.Designer.cs b/src/Aspire.Cli/Resources/DoCommandStrings.Designer.cs
index c7224cb9a1c..ab8fbd526f5 100644
--- a/src/Aspire.Cli/Resources/DoCommandStrings.Designer.cs
+++ b/src/Aspire.Cli/Resources/DoCommandStrings.Designer.cs
@@ -122,5 +122,23 @@ public static string StepArgumentDescription {
return ResourceManager.GetString("StepArgumentDescription", resourceCulture);
}
}
+
+ ///
+ /// Looks up a localized string similar to The 'step' argument is required..
+ ///
+ public static string StepArgumentRequired {
+ get {
+ return ResourceManager.GetString("StepArgumentRequired", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The 'step' argument is required when using --list-steps. Example: 'aspire do deploy --list-steps'. Common starting steps are 'build', 'publish' and 'deploy'. See https://aspire.dev/reference/cli/commands/aspire-do/ for the full list of pipeline steps..
+ ///
+ public static string ListStepsRequiresStep {
+ get {
+ return ResourceManager.GetString("ListStepsRequiresStep", resourceCulture);
+ }
+ }
}
}
diff --git a/src/Aspire.Cli/Resources/DoCommandStrings.resx b/src/Aspire.Cli/Resources/DoCommandStrings.resx
index 2db6a8643cd..1e5862df55b 100644
--- a/src/Aspire.Cli/Resources/DoCommandStrings.resx
+++ b/src/Aspire.Cli/Resources/DoCommandStrings.resx
@@ -138,4 +138,10 @@
The name of the step to execute
+
+ The 'step' argument is required.
+
+
+ The 'step' argument is required when using --list-steps. Example: 'aspire do deploy --list-steps'. Common starting steps are 'build', 'publish' and 'deploy'. See https://aspire.dev/reference/cli/commands/aspire-do/ for the full list of pipeline steps.
+
diff --git a/src/Aspire.Cli/Resources/xlf/DoCommandStrings.cs.xlf b/src/Aspire.Cli/Resources/xlf/DoCommandStrings.cs.xlf
index cded75496fa..1050dc23952 100644
--- a/src/Aspire.Cli/Resources/xlf/DoCommandStrings.cs.xlf
+++ b/src/Aspire.Cli/Resources/xlf/DoCommandStrings.cs.xlf
@@ -12,6 +12,11 @@
Provádí se kanál...
+
+ The 'step' argument is required when using --list-steps. Example: 'aspire do deploy --list-steps'. Common starting steps are 'build', 'publish' and 'deploy'. See https://aspire.dev/reference/cli/commands/aspire-do/ for the full list of pipeline steps.
+ The 'step' argument is required when using --list-steps. Example: 'aspire do deploy --list-steps'. Common starting steps are 'build', 'publish' and 'deploy'. See https://aspire.dev/reference/cli/commands/aspire-do/ for the full list of pipeline steps.
+
+ The operation was canceled.Operace byla zrušena.
@@ -37,6 +42,11 @@
Název kroku, který se má provést
+
+ The 'step' argument is required.
+ The 'step' argument is required.
+
+