# DotnetProgramBuildCompletionAnnotation Constructors

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

Provides an optional successful-build barrier for consumers of a .NET program's build output.

<a id="constructor"></a>
<a id="constructor-func-iserviceprovider-cancellationtoken-task"></a>

## DotnetProgramBuildCompletionAnnotation(Func<IServiceProvider, CancellationToken, Task>)

- Name: `Constructor(Func<IServiceProvider, CancellationToken, Task>)`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/f4c27f2d43ddc1cacd0dd083b30d1fea1cee7a62/src/Aspire.Hosting/ApplicationModel/DotnetProgramBuildCompletionAnnotation.cs#L25-L29)

Initializes a new instance of the [DotnetProgramBuildCompletionAnnotation](/reference/api/csharp/aspire.hosting/dotnetprogrambuildcompletionannotation.md) class.

```csharp
public sealed class DotnetProgramBuildCompletionAnnotation
{
    public DotnetProgramBuildCompletionAnnotation(
        Func<IServiceProvider, CancellationToken, Task> callback)
    {
        // ...
    }
}
```

## Parameters

- `callback` (`Func<IServiceProvider, CancellationToken, Task>`)
  The callback that waits for successful build completion using the application services and caller's cancellation token.

## Exceptions

- `ArgumentNullException` -- `callback` is `null`.
