# ManifestPublishingContext

- Kind: `class`
- Package: [Aspire.Hosting](/reference/api/csharp/aspire.hosting.md)
- Version: `13.3.0`
- Namespace: `Aspire.Hosting.Publishing`
- Target framework: `net8.0`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/Publishing/ManifestPublishingContext.cs)

Contextual information used for manifest publishing during this execution of the AppHost.

## Definition

```csharp
namespace Aspire.Hosting.Publishing;

public sealed class ManifestPublishingContext
{
    // ...
}
```

## Constructors

- [ManifestPublishingContext(DistributedApplicationExecutionContext, string, Utf8JsonWriter, CancellationToken)](/reference/api/csharp/aspire.hosting/manifestpublishingcontext/constructors.md#constructor-distributedapplicationexecutioncontext-string-utf8jsonwriter-cancellationtoken) -- Contextual information used for manifest publishing during this execution of the AppHost.

## Properties

- [CancellationToken](/reference/api/csharp/aspire.hosting/manifestpublishingcontext/properties.md#cancellationtoken) : `CancellationToken` `get` -- Gets cancellation token for this operation.
- [ExecutionContext](/reference/api/csharp/aspire.hosting/manifestpublishingcontext/properties.md#executioncontext) : [DistributedApplicationExecutionContext](/reference/api/csharp/aspire.hosting/distributedapplicationexecutioncontext.md) `get` -- Gets execution context for this invocation of the AppHost.
- [ManifestPath](/reference/api/csharp/aspire.hosting/manifestpublishingcontext/properties.md#manifestpath) : `string` `get` -- Gets manifest path specified for this invocation of the AppHost.
- [Writer](/reference/api/csharp/aspire.hosting/manifestpublishingcontext/properties.md#writer) : `Utf8JsonWriter` `get` -- Gets JSON writer for writing manifest entries.

## Methods

- [GetManifestRelativePath(string?)](/reference/api/csharp/aspire.hosting/manifestpublishingcontext/methods.md#getmanifestrelativepath-string) : `string?` -- Generates a relative path based on the location of the manifest path.
- [TryAddDependentResources(object?)](/reference/api/csharp/aspire.hosting/manifestpublishingcontext/methods.md#tryadddependentresources-object) -- Ensures that any [IResource](/reference/api/csharp/aspire.hosting/iresource.md) instances referenced by `value` are written to the manifest.
- [WriteBindings(IResource)](/reference/api/csharp/aspire.hosting/manifestpublishingcontext/methods.md#writebindings-iresource) -- Writes endpoints to the resource entry in the manifest based on the resource's [EndpointAnnotation](/reference/api/csharp/aspire.hosting/endpointannotation.md) entries in the [IResource.Annotations](/reference/api/csharp/aspire.hosting/iresource/properties.md#annotations) collection.
- [WriteCommandLineArgumentsAsync(IResource)](/reference/api/csharp/aspire.hosting/manifestpublishingcontext/methods.md#writecommandlineargumentsasync-iresource) : `Task` -- Writes command line arguments to the manifest based on the [IResource](/reference/api/csharp/aspire.hosting/iresource.md) resource's [CommandLineArgsCallbackAnnotation](/reference/api/csharp/aspire.hosting/commandlineargscallbackannotation.md) annotations.
- [WriteConnectionString(IResource)](/reference/api/csharp/aspire.hosting/manifestpublishingcontext/methods.md#writeconnectionstring-iresource) -- Writes the "connectionString" field for the underlying resource.
- [WriteContainerAsync(ContainerResource)](/reference/api/csharp/aspire.hosting/manifestpublishingcontext/methods.md#writecontainerasync-containerresource) : `Task` -- Writes JSON elements to the manifest which represent a container resource.
- [WriteEnvironmentVariablesAsync(IResource)](/reference/api/csharp/aspire.hosting/manifestpublishingcontext/methods.md#writeenvironmentvariablesasync-iresource) : `Task` -- Writes environment variables to the manifest base on the [IResource](/reference/api/csharp/aspire.hosting/iresource.md) resource's [EnvironmentCallbackAnnotation](/reference/api/csharp/aspire.hosting/environmentcallbackannotation.md) annotations."/>
