Watch Aspire live streamsDocsTry Aspire

withCommand

Method
📦 Aspire.Hosting v17.0.0
interface ContainerResource {
// ... omitted for brevity
withCommand(
name: string,
displayName: string,
executeCommand: callback,
commandOptions?: CommandOptions): IResource;
}

Signature

methodwithCommandbuilder
Adds a resource command
withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise<ExecuteCommandResult>, commandOptions?: CommandOptions): IResource
namestringThe name of the command. The name uniquely identifies the command.
displayNamestringThe display name visible in UI.
executeCommand(arg: ExecuteCommandContext) => Promise<ExecuteCommandResult>A callback that is executed when the command is executed. The callback is run inside the Aspire host. The callback result is used to indicate success or failure in the UI.
commandOptionsCommandOptionsoptionalOptional configuration for the command.
IResource

Applies to

This method applies to the following types: