aspire exec command
此内容尚不支持你的语言。
This article applies to: ✔️ Aspire CLI 9.4.0 and later versions.
aspire exec - Run an Aspire AppHost to execute a command against the resource.
Synopsis
Section titled “Synopsis”aspire exec [options] [[--] <additional arguments>...]Description
Section titled “Description”The aspire exec command runs a command in the context of one of the resources defined in the AppHost.
You must specify either the --resource or the --start-resource option, and you must provide parameters with the -- option.
The Aspire CLI uses the following logic, in order, to determine which AppHost project to process:
-
The
--projectoption.This option specifies the path to a project to process.
-
The
.aspire/settings.jsonconfig 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
appHostPathsetting 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.jsonconfig file.
Options
Section titled “Options”The following options are available:
-
--Delimits arguments to
aspire execfrom arguments for the resource. All arguments after this delimiter are passed to the resource. -
--projectThe path to the Aspire AppHost project file.
-
-r, --resourceThe name of the target resource to execute the command against.
-
-s, --start-resourceThe name of the target resource to start and execute the command against.
-
-?, -h, --helpPrints help and usage documentation for the available commands and options.
-
-d, --debugEnable debug logging to the console, which prints detailed information about what .NET Aspire CLI is doing when a command is run.
-
--wait-for-debuggerWait for a debugger to attach before running a command.
Examples
Section titled “Examples”-
Builds and runs the AppHost project, then sends the command
migrateto thedatabase1resource:Aspire CLI aspire exec --resource database1 -- migrate