इसे छोड़कर कंटेंट पर जाएं
Docs Try Aspire
Docs Try

aspire update command

यह कंटेंट अभी तक आपकी भाषा में उपलब्ध नहीं है।

aspire update - Update Aspire packages and templates in your project.

Aspire CLI
aspire update [options]

The aspire update command helps you keep your Aspire projects current by automatically detecting and updating outdated packages and templates. It finds outdated Aspire NuGet packages while respecting channel configurations and intelligently handles complex dependency graphs.

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

  • The --apphost option.

    This option specifies the path to the Aspire AppHost project file to process.

  • The rooted aspire.config.json file.

    If the rooted config exists in the current directory, it’s used. If not, the CLI walks up the directory structure looking for it. If Aspire finds the rooted config, it uses the recorded AppHost information to determine which project to process. Legacy .aspire/settings.json files are still read during migration.

  • 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, Aspire records that selection in the rooted configuration so later commands can reuse it.

The command performs the following:

  • Detects outdated Aspire NuGet packages in your project
  • Respects your configured Aspire channel (preview, stable, etc.)
  • Resolves diamond dependencies to avoid duplicate updates
  • Applies all package version edits before running a single final dotnet restore, so channel switches that add NuGet source mappings don’t cause restore failures mid-update
  • Provides colorized output with detailed summary of changes

When you use --non-interactive, also pass --yes to explicitly confirm the update operation. Omitting --yes when using --non-interactive is an error:

Aspire CLI
aspire update --yes --non-interactive

If you specify --non-interactive without --yes, the command exits with an error:

Output
The update command requires --yes when the --non-interactive option is specified.

When updating a guest AppHost project, such as a TypeScript AppHost, aspire update checks the selected Aspire SDK version before modifying files. If the selected SDK is newer than the running Aspire CLI, the command prompts you to update the CLI first:

Output
The selected Aspire SDK is newer than this Aspire CLI. Update the Aspire CLI now and re-run `aspire update` to update this project?

If you confirm, the CLI updates itself and skips the project update. When the CLI is installed from npm or as a .NET tool, the command prints the matching package-manager update command to run manually instead:

Output
Project update skipped. Update the Aspire CLI, then re-run `aspire update`.

After updating the CLI, re-run aspire update to complete the project update. This check helps prevent a guest AppHost project from being left in a broken state when the CLI’s bundled code generator doesn’t support the selected SDK version.

Updating the CLI based on how it was installed

Section titled “Updating the CLI based on how it was installed”

aspire update --self (and the update notice shown when a newer version is available) adapts to how the CLI was installed so it doesn’t overwrite files owned by a package manager:

  • When the CLI was installed from npm (the @microsoft/aspire-cli package), the command prints the npm update command to run instead of downloading a new binary:

    Output
    To update the Aspire CLI when installed from npm, run:
    npm install -g @microsoft/aspire-cli@latest
  • When the CLI was installed with the install script or another binary install, aspire update --self downloads and installs the latest CLI binary directly.

  • When the CLI was installed as a .NET tool, the command prints the dotnet tool update command to run.

The following options are available:

  • --apphost <apphost>

    The path to the Aspire AppHost file or project file, such as apphost.mts, apphost.cs, or an AppHost .csproj.

  • --self

    Update the Aspire CLI itself to the latest version. The CLI adapts to how it was installed: npm and .NET tool installs print the matching package-manager command to run, while install-script and other binary installs download the latest binary directly. See Updating the CLI based on how it was installed.

  • --channel

    Channel to update to (stable, staging, daily). When switching channels, aspire update applies all package version edits to your project first and then runs a single dotnet restore, ensuring that NuGet source mappings added for the target channel are in place before any restore is attempted.

    When you switch to a persistable channel, such as daily, aspire update also rewrites the top-level channel key in aspire.config.json when the file already exists. Only channels registered as explicit channels are persisted, with one exception: the stable channel is treated as the portable default and is intentionally not pinned. The persisted channel keeps subsequent aspire add and aspire update runs resolving packages against the channel you just switched to.

  • -y, --yes

    Automatically confirm all prompts without user input. Use this option in CI/CD pipelines or other non-interactive environments to skip confirmation dialogs.

  • --nuget-config-dir

    Path to the directory containing the NuGet.Config file to use when searching for packages. When not specified, the command searches for a NuGet.Config file in the current directory and its parents.

  • -?, -h, --help

    Prints 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-interactive

    Run the command in non-interactive mode, disabling all interactive prompts and spinners.

  • --nologo

    Suppress the startup banner and telemetry notice.

  • --banner

    Display the animated Aspire CLI welcome banner.

  • --wait-for-debugger

    Wait for a debugger to attach before running a command.

  • Analyze and update out-of-date Aspire packages and templates:

    Aspire CLI
    aspire update
  • Update a specific AppHost project:

    Aspire CLI
    aspire update --apphost './projects/apphost/orchestration.AppHost.csproj'
  • Update packages in a CI/CD pipeline without interactive prompts:

    Aspire CLI
    aspire update --yes --non-interactive
  • Update packages using a specific NuGet configuration file:

    Aspire CLI
    aspire update --nuget-config-dir './config'
  • Update packages to the daily preview channel:

    Aspire CLI
    aspire update --channel daily