# EnvironmentCallbackAnnotation

- Kind: `class`
- Package: [Aspire.Hosting](/reference/api/csharp/aspire.hosting.md)
- Version: `13.3.0`
- Namespace: `Aspire.Hosting.ApplicationModel`
- Target framework: `net8.0`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/ApplicationModel/EnvironmentCallbackAnnotation.cs)
- Implements: `ICallbackResourceAnnotation<EnvironmentCallbackContext, Dictionary<string, object>>`, [IResourceAnnotation](/reference/api/csharp/aspire.hosting/iresourceannotation.md)

Represents an annotation that provides a callback to modify the environment variables of an application.

## Definition

```csharp
namespace Aspire.Hosting.ApplicationModel;

public class EnvironmentCallbackAnnotation
    : Aspire.Hosting.ApplicationModel.ICallbackResourceAnnotation<Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext, System.Collections.Generic.Dictionary<string, object>>,
      Aspire.Hosting.ApplicationModel.IResourceAnnotation
{
    // ...
}
```

## Constructors

- [EnvironmentCallbackAnnotation(string, Func<string>)](/reference/api/csharp/aspire.hosting/environmentcallbackannotation/constructors.md#constructor-string-func-string) -- Initializes a new instance of the [EnvironmentCallbackAnnotation](/reference/api/csharp/aspire.hosting/environmentcallbackannotation.md) class with the specified name and callback function.
- [EnvironmentCallbackAnnotation(Action<Dictionary<string, object>>)](/reference/api/csharp/aspire.hosting/environmentcallbackannotation/constructors.md#constructor-action-dictionary-string-object) -- Initializes a new instance of the [EnvironmentCallbackAnnotation](/reference/api/csharp/aspire.hosting/environmentcallbackannotation.md) class with the specified callback action.
- [EnvironmentCallbackAnnotation(Action<EnvironmentCallbackContext>)](/reference/api/csharp/aspire.hosting/environmentcallbackannotation/constructors.md#constructor-action-environmentcallbackcontext) -- Initializes a new instance of the [EnvironmentCallbackAnnotation](/reference/api/csharp/aspire.hosting/environmentcallbackannotation.md) class with the specified callback.
- [EnvironmentCallbackAnnotation(Func<EnvironmentCallbackContext, Task>)](/reference/api/csharp/aspire.hosting/environmentcallbackannotation/constructors.md#constructor-func-environmentcallbackcontext-task) -- Initializes a new instance of the [EnvironmentCallbackAnnotation](/reference/api/csharp/aspire.hosting/environmentcallbackannotation.md) class with the specified callback.

## Properties

- [Callback](/reference/api/csharp/aspire.hosting/environmentcallbackannotation/properties.md#callback) : `Func<EnvironmentCallbackContext, Task>` `get` -- Gets or sets the callback action to be executed when the environment is being built.
