# ContainerBuildOptionsCallbackContext Constructors

- Package: [Aspire.Hosting](/reference/api/csharp/aspire.hosting.md)
- Type: [ContainerBuildOptionsCallbackContext](/reference/api/csharp/aspire.hosting/containerbuildoptionscallbackcontext.md)
- Kind: `Constructors`
- Members: `1`

Context for configuring container build options via a callback.

## ContainerBuildOptionsCallbackContext(IResource, IServiceProvider, ILogger, CancellationToken, DistributedApplicationExecutionContext?)

- Name: `Constructor(IResource, IServiceProvider, ILogger, CancellationToken, DistributedApplicationExecutionContext?)`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/ApplicationModel/ContainerBuildOptionsCallbackAnnotation.cs#L50-L62)

Initializes a new instance of [ContainerBuildOptionsCallbackContext](/reference/api/csharp/aspire.hosting/containerbuildoptionscallbackcontext.md).

```csharp
public sealed class ContainerBuildOptionsCallbackContext
{
    public ContainerBuildOptionsCallbackContext(
        IResource resource,
        IServiceProvider services,
        ILogger logger,
        CancellationToken cancellationToken,
        DistributedApplicationExecutionContext? executionContext = null)
    {
        // ...
    }
}
```

## Parameters

- `resource` ([IResource](/reference/api/csharp/aspire.hosting/iresource.md))
  The resource being built.
- `services` (`IServiceProvider`)
  The service provider.
- `logger` (`ILogger`)
  The logger instance.
- `cancellationToken` (`CancellationToken`)
  The cancellation token.
- `executionContext` ([DistributedApplicationExecutionContext?](/reference/api/csharp/aspire.hosting/distributedapplicationexecutioncontext.md)) `optional`
  The distributed application execution context.
