Aspirerelease/17.0
Watch Aspire live streamsDocsTry Aspire

WithRequiredCommandValidation

Method
📦 Aspire.Hosting v17.0.0
func (Resource) WithRequiredCommandValidation(
command string,
validationCallback func(arg RequiredCommandValidationContext) RequiredCommandValidationResult,
options ...*WithRequiredCommandValidationOptions,
) Resource

Signature

methodWithRequiredCommandValidationbuilder
Declares that a resource requires a specific command/executable to be available on the local machine PATH before it can start, with custom validation logic.
WithRequiredCommandValidation(
command string,
validationCallback func(arg RequiredCommandValidationContext) RequiredCommandValidationResult,
options ...*WithRequiredCommandValidationOptions,
) Resource
commandstringThe command string (file name or path) that should be validated.
validationCallbackfunc(arg RequiredCommandValidationContext) RequiredCommandValidationResultcallbackA callback that validates the resolved command path. Receives a RequiredCommandValidationContext and returns a RequiredCommandValidationResult.
options...*WithRequiredCommandValidationOptionsOptional settings, described under Options.

Optional parameters are passed in a trailing options ...*WithRequiredCommandValidationOptions argument.

HelpLink*stringAn optional help link URL to guide users when the command is missing or fails validation.
Resource

The resource builder.

Returns a handle; failures surface later via Err().

Applies to

This method applies to the following types: