# IRequiredCommandValidator Methods

- Package: [Aspire.Hosting](/reference/api/csharp/aspire.hosting.md)
- Type: [IRequiredCommandValidator](/reference/api/csharp/aspire.hosting/irequiredcommandvalidator.md)
- Kind: `Methods`
- Members: `1`

A service that validates required commands/executables are available on the local machine.

## ValidateAsync(IResource, RequiredCommandAnnotation, CancellationToken)

- Name: `ValidateAsync(IResource, RequiredCommandAnnotation, CancellationToken)`
- Modifiers: `abstract`
- Returns: [Task<RequiredCommandValidationResult>](/reference/api/csharp/aspire.hosting/requiredcommandvalidationresult.md)

Validates that a required command is available and meets any custom validation requirements.

```csharp
public interface IRequiredCommandValidator
{
    public abstract Task<RequiredCommandValidationResult> ValidateAsync(
        IResource resource,
        RequiredCommandAnnotation annotation,
        CancellationToken cancellationToken)
    {
        // ...
    }
}
```

## Parameters

- `resource` ([IResource](/reference/api/csharp/aspire.hosting/iresource.md))
  The resource that requires the command.
- `annotation` ([RequiredCommandAnnotation](/reference/api/csharp/aspire.hosting/requiredcommandannotation.md))
  The annotation describing the required command.
- `cancellationToken` (`CancellationToken`)
  A cancellation token.

## Returns

[Task<RequiredCommandValidationResult>](/reference/api/csharp/aspire.hosting/requiredcommandvalidationresult.md) -- A [RequiredCommandValidationResult](/reference/api/csharp/aspire.hosting/requiredcommandvalidationresult.md) indicating whether validation succeeded.

## Remarks

Validations are coalesced per command. If the same command has already been validated, the cached result is used. If validation fails, a warning is logged but the resource is allowed to attempt to start.
