Перейти до вмісту

aspire do command

Цей контент ще не доступний вашою мовою.

aspire do - Execute a specific pipeline step and its dependencies.

Aspire CLI
aspire do <step> [options] [[--] <additional arguments>...]

The aspire do command executes a specific pipeline step and its dependencies in your Aspire AppHost. This command provides fine-grained control over the orchestration pipeline, allowing you to run individual steps of the deployment or build process.

The Aspire CLI uses the following logic, in order, to determine which AppHost project to process:

  • The --project option.

    This option specifies the path to a project to process.

  • The .aspire/settings.json config file.

    If the config file path exists in the current directory, it’s used. If not, the CLI walks up the directory structure looking for the config file. If it finds a config file, it reads the appHostPath setting value as the project to process.

  • Searches the current directory and subdirectories.

    Starting in the current directory, the CLI gathers all AppHost projects from that directory and below. If a single project is discovered, it’s automatically selected. If multiple projects are discovered, they’re printed to the terminal for the user to manually select one of the projects.

    Once a project is selected, either automatically or manually, the path to the project is stored in the .aspire/settings.json config file.

The command allows you to:

  • Execute specific pipeline steps without running the entire pipeline
  • Run only the dependencies needed for a particular step
  • Test individual pipeline stages during development
  • Customize pipeline execution with environment-specific settings
  • Discover available steps and their dependencies using the diagnostics step

For more information, see Pipelines and app topology.

The following arguments are available:

  • step

    The name of the step to execute.

The following options are available:

  • --

    Delimits arguments to aspire do from arguments for the AppHost. All arguments after this delimiter are passed to the application being run.

  • --project

    The path to the Aspire AppHost project file.

  • -o, --output-path

    The optional output path for artifacts.

  • --log-level

    Set the minimum log level for pipeline logging. Valid values are: trace, debug, information, warning, error, critical. The default is information.

  • -e, --environment

    The environment to use for the operation. The default is Production.

  • --include-exception-details

    Include exception details (stack traces) in pipeline logs.

  • -?, -h, --help

    Prints help and usage documentation for the available commands and options.

  • -d, --debug

    Enable debug logging to the console, which prints detailed information about what Aspire CLI is doing when a command is run.

  • --wait-for-debugger

    Wait for a debugger to attach before running a command.

Before executing a pipeline step, you can discover what steps are available in your application’s pipeline and understand their dependencies using the diagnostics step.

The aspire do diagnostics command provides comprehensive information about your pipeline, including:

  • All available steps and their dependencies
  • Execution order with parallelization indicators
  • Step dependencies and target resources
  • Configuration issues like orphaned steps or circular dependencies

This is particularly useful after installing a deployment package or when you want to understand which steps will execute for a given command.

Aspire provides several well-known steps that serve as entry points for common operations:

  • build: Builds container images for compute resources defined in the application
  • push: Pushes container images to registries after they have been built
  • publish: Generates deployment artifacts by serializing resources to disk
  • deploy: Orchestrates the complete deployment process including infrastructure provisioning, image building, and application deployment

Resources in your application can contribute their own custom steps, and you can add application-specific steps through the pipeline API.

The following examples demonstrate common pipeline operations:

  • Examine the pipeline structure and available steps:

    Aspire CLI
    aspire do diagnostics

    This displays all steps in your pipeline, their dependencies, and execution order. Use this to understand what steps are available and how they relate to each other.

  • Build container images for your application:

    Aspire CLI
    aspire do build

    This builds all container images for compute resources defined in your AppHost.

  • Push container images to a registry:

    Aspire CLI
    aspire do push

    This pushes built container images to their configured registries. The push step automatically includes its dependencies (building images and ensuring registry availability) before pushing.

  • Execute a pipeline step with debug logging:

    Aspire CLI
    aspire do deploy --log-level debug

    Use debug logging to get detailed troubleshooting output during step execution.

  • Execute a pipeline step for a specific environment:

    Aspire CLI
    aspire do publish --environment Staging

    Target different environments to use environment-specific configurations.

  • Execute a pipeline step with custom output path:

    Aspire CLI
    aspire do publish --output-path ./artifacts

    Specify where publishing artifacts should be written.

  • Execute a pipeline step with additional arguments:

    Aspire CLI
    aspire do test -- --configuration Release

    Pass additional arguments to the AppHost after the -- delimiter.