aspire stop command
aspire stop - Stop a running Aspire AppHost.
Synopsis
Section titled “Synopsis”aspire stop [options]Description
Section titled “Description”The aspire stop command stops a running Aspire AppHost process. When no options are provided, the command scans for running AppHosts and stops the in-scope AppHost directly, or prompts you to choose one when multiple AppHosts are available.
When executed without the --apphost option, the command:
- Scans for all running AppHost processes.
- If multiple AppHosts are running within the current directory scope, prompts you to select which one to stop.
- If only one AppHost is running in scope, stops it directly.
- If no in-scope AppHosts are found but out-of-scope AppHosts exist, displays all running AppHosts for selection.
The command requests a graceful shutdown of the selected AppHost process (and its process tree), coordinating a clean shutdown of the AppHost, dashboard, and non-persistent containers and processes. Resources configured with a persistent lifetime remain available for later runs.
Clean up persistent resources
Section titled “Clean up persistent resources”Use --force to stop the selected AppHost and then remove the persistent resources associated with it:
aspire stop --forceThe command performs the normal stop flow first, then removes persistent resources associated with the AppHost. The command attempts to clean up persistent resources whether or not an instance of the AppHost is running. Persistent resources started using a version of the Aspire CLI released before --force support was added can’t be cleaned up using --force.
Additional notes and limitations:
- You can’t combine
--forcewith--all; cleaning up persistent resources is only supported when stopping instances of a specific AppHost. - AppHost instances and associated persistent resources are resolved based on the AppHost path. If you remove or rename an AppHost after it creates persistent resources, the command won’t associate previously created persistent resources with the AppHost at its new path. In that case, either run
aspire stop --forcebefore renaming the AppHost or manually clean up the associated persistent resources. - For a .NET AppHost that doesn’t use the Aspire CLI bundle, cleanup requires Aspire.Hosting 13.5 or later. If the AppHost uses an older version, its version can’t be determined, or its project can’t be inspected, the command displays a warning and still attempts cleanup. Resources created without the required workload metadata might remain.
- If the AppHost stops successfully, but persistent resource cleanup fails, the command exits with an error but leaves the AppHost stopped. You can resolve any errors and run
aspire stop --forceagain or manually clean up any remaining persistent resources if necessary.
Options
Section titled “Options”The following options are available:
-
--apphost <apphost>The path to the Aspire AppHost project file. When specified, the command stops only the AppHost running from that AppHost project without prompting for selection.
-
--allStop all running AppHosts without prompting for selection. You can’t combine this option with
--force. -
--forcePerform the normal attempt to stop all instances of a specific AppHost, then attempt to clean up persistent resources associated with that AppHost. You can combine this option with
--apphostto specify an AppHost to stop, but not with--all. -
-?, -h, --helpPrints help and usage documentation for the available commands and options.
-
-l, --log-level <Critical|Debug|Error|Information|None|Trace|Warning>Set the minimum log level for console output. Use this option to increase diagnostics while troubleshooting or reduce output in scripted runs.
-
--non-interactiveRun the command in non-interactive mode, disabling all interactive prompts and spinners.
-
--nologoSuppress the startup banner and telemetry notice.
-
--bannerDisplay the animated Aspire CLI welcome banner.
-
--wait-for-debuggerWait for a debugger to attach before running a command.
Examples
Section titled “Examples”-
Stop the AppHost running in the current directory scope:
Aspire CLI aspire stop -
Stop a specific AppHost project:
Aspire CLI aspire stop --apphost './src/MyApp.AppHost/MyApp.AppHost.csproj' -
Stop all running AppHosts:
Aspire CLI aspire stop --all -
Stop the AppHost and clean up its persistent resources:
Aspire CLI aspire stop --force -
Stop any running instances and clean up persistent resources for a specific AppHost when the target AppHost might be ambiguous:
Aspire CLI aspire stop --force --apphost './src/MyApp.AppHost/MyApp.AppHost.csproj'