# PublishingExtensions Methods

- Package: [Aspire.Hosting](/reference/api/csharp/aspire.hosting.md)
- Type: [PublishingExtensions](/reference/api/csharp/aspire.hosting/publishingextensions.md)
- Kind: `Methods`
- Members: `14`

Extension methods for [IReportingStep](/reference/api/csharp/aspire.hosting/ireportingstep.md) and [IReportingTask](/reference/api/csharp/aspire.hosting/ireportingtask.md) to provide direct operations.

## FailAsync(IReportingStep, string?, CancellationToken)

- Name: `FailAsync(IReportingStep, string?, CancellationToken)`
- Modifiers: `extension`
- Returns: [Task<IReportingStep>](/reference/api/csharp/aspire.hosting/ireportingstep.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/Publishing/PublishingExtensions.cs)

Completes a publishing step with an error.

```csharp
public static class PublishingExtensions
{
    public static Task<IReportingStep> FailAsync(
        this IReportingStep step,
        string? errorMessage = null,
        CancellationToken cancellationToken = default(CancellationToken))
    {
        // ...
    }
}
```

## Parameters

- `step` ([IReportingStep](/reference/api/csharp/aspire.hosting/ireportingstep.md))
  The step to complete.
- `errorMessage` (`string?`) `optional`
  Optional error message.
- `cancellationToken` (`CancellationToken`) `optional`
  The cancellation token.

## Returns

[Task<IReportingStep>](/reference/api/csharp/aspire.hosting/ireportingstep.md) -- The completed step.

## FailAsync(IReportingStep, MarkdownString, CancellationToken)

- Name: `FailAsync(IReportingStep, MarkdownString, CancellationToken)`
- Modifiers: `extension`
- Returns: [Task<IReportingStep>](/reference/api/csharp/aspire.hosting/ireportingstep.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/Publishing/PublishingExtensions.cs)

Completes a publishing step with an error and Markdown-formatted message.

```csharp
public static class PublishingExtensions
{
    public static Task<IReportingStep> FailAsync(
        this IReportingStep step,
        MarkdownString errorMessage,
        CancellationToken cancellationToken = default(CancellationToken))
    {
        // ...
    }
}
```

## Parameters

- `step` ([IReportingStep](/reference/api/csharp/aspire.hosting/ireportingstep.md))
  The step to complete.
- `errorMessage` ([MarkdownString](/reference/api/csharp/aspire.hosting/markdownstring.md))
  The Markdown-formatted error message.
- `cancellationToken` (`CancellationToken`) `optional`
  The cancellation token.

## Returns

[Task<IReportingStep>](/reference/api/csharp/aspire.hosting/ireportingstep.md) -- The completed step.

## FailAsync(IReportingTask, string?, CancellationToken)

- Name: `FailAsync(IReportingTask, string?, CancellationToken)`
- Modifiers: `extension`
- Returns: [Task<IReportingTask>](/reference/api/csharp/aspire.hosting/ireportingtask.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/Publishing/PublishingExtensions.cs)

Completes a publishing task with an error.

```csharp
public static class PublishingExtensions
{
    public static Task<IReportingTask> FailAsync(
        this IReportingTask task,
        string? errorMessage = null,
        CancellationToken cancellationToken = default(CancellationToken))
    {
        // ...
    }
}
```

## Parameters

- `task` ([IReportingTask](/reference/api/csharp/aspire.hosting/ireportingtask.md))
  The task to complete.
- `errorMessage` (`string?`) `optional`
  Optional error message.
- `cancellationToken` (`CancellationToken`) `optional`
  The cancellation token.

## Returns

[Task<IReportingTask>](/reference/api/csharp/aspire.hosting/ireportingtask.md) -- The completed task.

## FailAsync(IReportingTask, MarkdownString, CancellationToken)

- Name: `FailAsync(IReportingTask, MarkdownString, CancellationToken)`
- Modifiers: `extension`
- Returns: [Task<IReportingTask>](/reference/api/csharp/aspire.hosting/ireportingtask.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/Publishing/PublishingExtensions.cs)

Completes a publishing task with an error and Markdown-formatted message.

```csharp
public static class PublishingExtensions
{
    public static Task<IReportingTask> FailAsync(
        this IReportingTask task,
        MarkdownString errorMessage,
        CancellationToken cancellationToken = default(CancellationToken))
    {
        // ...
    }
}
```

## Parameters

- `task` ([IReportingTask](/reference/api/csharp/aspire.hosting/ireportingtask.md))
  The task to complete.
- `errorMessage` ([MarkdownString](/reference/api/csharp/aspire.hosting/markdownstring.md))
  The Markdown-formatted error message.
- `cancellationToken` (`CancellationToken`) `optional`
  The cancellation token.

## Returns

[Task<IReportingTask>](/reference/api/csharp/aspire.hosting/ireportingtask.md) -- The completed task.

## SucceedAsync(IReportingStep, string?, CancellationToken)

- Name: `SucceedAsync(IReportingStep, string?, CancellationToken)`
- Modifiers: `extension`
- Returns: [Task<IReportingStep>](/reference/api/csharp/aspire.hosting/ireportingstep.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/Publishing/PublishingExtensions.cs)

Completes a publishing step successfully.

```csharp
public static class PublishingExtensions
{
    public static Task<IReportingStep> SucceedAsync(
        this IReportingStep step,
        string? message = null,
        CancellationToken cancellationToken = default(CancellationToken))
    {
        // ...
    }
}
```

## Parameters

- `step` ([IReportingStep](/reference/api/csharp/aspire.hosting/ireportingstep.md))
  The step to complete.
- `message` (`string?`) `optional`
  Optional completion message.
- `cancellationToken` (`CancellationToken`) `optional`
  The cancellation token.

## Returns

[Task<IReportingStep>](/reference/api/csharp/aspire.hosting/ireportingstep.md) -- The completed step.

## SucceedAsync(IReportingStep, MarkdownString, CancellationToken)

- Name: `SucceedAsync(IReportingStep, MarkdownString, CancellationToken)`
- Modifiers: `extension`
- Returns: [Task<IReportingStep>](/reference/api/csharp/aspire.hosting/ireportingstep.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/Publishing/PublishingExtensions.cs)

Completes a publishing step successfully with a Markdown-formatted message.

```csharp
public static class PublishingExtensions
{
    public static Task<IReportingStep> SucceedAsync(
        this IReportingStep step,
        MarkdownString message,
        CancellationToken cancellationToken = default(CancellationToken))
    {
        // ...
    }
}
```

## Parameters

- `step` ([IReportingStep](/reference/api/csharp/aspire.hosting/ireportingstep.md))
  The step to complete.
- `message` ([MarkdownString](/reference/api/csharp/aspire.hosting/markdownstring.md))
  The Markdown-formatted completion message.
- `cancellationToken` (`CancellationToken`) `optional`
  The cancellation token.

## Returns

[Task<IReportingStep>](/reference/api/csharp/aspire.hosting/ireportingstep.md) -- The completed step.

## SucceedAsync(IReportingTask, string?, CancellationToken)

- Name: `SucceedAsync(IReportingTask, string?, CancellationToken)`
- Modifiers: `extension`
- Returns: [Task<IReportingTask>](/reference/api/csharp/aspire.hosting/ireportingtask.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/Publishing/PublishingExtensions.cs)

Completes a publishing task successfully.

```csharp
public static class PublishingExtensions
{
    public static Task<IReportingTask> SucceedAsync(
        this IReportingTask task,
        string? message = null,
        CancellationToken cancellationToken = default(CancellationToken))
    {
        // ...
    }
}
```

## Parameters

- `task` ([IReportingTask](/reference/api/csharp/aspire.hosting/ireportingtask.md))
  The task to complete.
- `message` (`string?`) `optional`
  Optional completion message.
- `cancellationToken` (`CancellationToken`) `optional`
  The cancellation token.

## Returns

[Task<IReportingTask>](/reference/api/csharp/aspire.hosting/ireportingtask.md) -- The completed task.

## SucceedAsync(IReportingTask, MarkdownString, CancellationToken)

- Name: `SucceedAsync(IReportingTask, MarkdownString, CancellationToken)`
- Modifiers: `extension`
- Returns: [Task<IReportingTask>](/reference/api/csharp/aspire.hosting/ireportingtask.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/Publishing/PublishingExtensions.cs)

Completes a publishing task successfully with a Markdown-formatted message.

```csharp
public static class PublishingExtensions
{
    public static Task<IReportingTask> SucceedAsync(
        this IReportingTask task,
        MarkdownString message,
        CancellationToken cancellationToken = default(CancellationToken))
    {
        // ...
    }
}
```

## Parameters

- `task` ([IReportingTask](/reference/api/csharp/aspire.hosting/ireportingtask.md))
  The task to complete.
- `message` ([MarkdownString](/reference/api/csharp/aspire.hosting/markdownstring.md))
  The Markdown-formatted completion message.
- `cancellationToken` (`CancellationToken`) `optional`
  The cancellation token.

## Returns

[Task<IReportingTask>](/reference/api/csharp/aspire.hosting/ireportingtask.md) -- The completed task.

## UpdateStatusAsync(IReportingTask, string, CancellationToken)

- Name: `UpdateStatusAsync(IReportingTask, string, CancellationToken)`
- Modifiers: `extension`
- Returns: [Task<IReportingTask>](/reference/api/csharp/aspire.hosting/ireportingtask.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/Publishing/PublishingExtensions.cs)

Updates the status text of a publishing task.

```csharp
public static class PublishingExtensions
{
    public static Task<IReportingTask> UpdateStatusAsync(
        this IReportingTask task,
        string statusText,
        CancellationToken cancellationToken = default(CancellationToken))
    {
        // ...
    }
}
```

## Parameters

- `task` ([IReportingTask](/reference/api/csharp/aspire.hosting/ireportingtask.md))
  The task to update.
- `statusText` (`string`)
  The new status text.
- `cancellationToken` (`CancellationToken`) `optional`
  The cancellation token.

## Returns

[Task<IReportingTask>](/reference/api/csharp/aspire.hosting/ireportingtask.md) -- The updated task.

## UpdateStatusAsync(IReportingTask, MarkdownString, CancellationToken)

- Name: `UpdateStatusAsync(IReportingTask, MarkdownString, CancellationToken)`
- Modifiers: `extension`
- Returns: [Task<IReportingTask>](/reference/api/csharp/aspire.hosting/ireportingtask.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/Publishing/PublishingExtensions.cs)

Updates the status text of a publishing task with Markdown-formatted text.

```csharp
public static class PublishingExtensions
{
    public static Task<IReportingTask> UpdateStatusAsync(
        this IReportingTask task,
        MarkdownString statusText,
        CancellationToken cancellationToken = default(CancellationToken))
    {
        // ...
    }
}
```

## Parameters

- `task` ([IReportingTask](/reference/api/csharp/aspire.hosting/ireportingtask.md))
  The task to update.
- `statusText` ([MarkdownString](/reference/api/csharp/aspire.hosting/markdownstring.md))
  The new Markdown-formatted status text.
- `cancellationToken` (`CancellationToken`) `optional`
  The cancellation token.

## Returns

[Task<IReportingTask>](/reference/api/csharp/aspire.hosting/ireportingtask.md) -- The updated task.

## WarnAsync(IReportingStep, string?, CancellationToken)

- Name: `WarnAsync(IReportingStep, string?, CancellationToken)`
- Modifiers: `extension`
- Returns: [Task<IReportingStep>](/reference/api/csharp/aspire.hosting/ireportingstep.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/Publishing/PublishingExtensions.cs)

Completes a publishing step with a warning.

```csharp
public static class PublishingExtensions
{
    public static Task<IReportingStep> WarnAsync(
        this IReportingStep step,
        string? message = null,
        CancellationToken cancellationToken = default(CancellationToken))
    {
        // ...
    }
}
```

## Parameters

- `step` ([IReportingStep](/reference/api/csharp/aspire.hosting/ireportingstep.md))
  The step to complete.
- `message` (`string?`) `optional`
  Optional completion message.
- `cancellationToken` (`CancellationToken`) `optional`
  The cancellation token.

## Returns

[Task<IReportingStep>](/reference/api/csharp/aspire.hosting/ireportingstep.md) -- The completed step.

## WarnAsync(IReportingStep, MarkdownString, CancellationToken)

- Name: `WarnAsync(IReportingStep, MarkdownString, CancellationToken)`
- Modifiers: `extension`
- Returns: [Task<IReportingStep>](/reference/api/csharp/aspire.hosting/ireportingstep.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/Publishing/PublishingExtensions.cs)

Completes a publishing step with a warning and Markdown-formatted message.

```csharp
public static class PublishingExtensions
{
    public static Task<IReportingStep> WarnAsync(
        this IReportingStep step,
        MarkdownString message,
        CancellationToken cancellationToken = default(CancellationToken))
    {
        // ...
    }
}
```

## Parameters

- `step` ([IReportingStep](/reference/api/csharp/aspire.hosting/ireportingstep.md))
  The step to complete.
- `message` ([MarkdownString](/reference/api/csharp/aspire.hosting/markdownstring.md))
  The Markdown-formatted warning message.
- `cancellationToken` (`CancellationToken`) `optional`
  The cancellation token.

## Returns

[Task<IReportingStep>](/reference/api/csharp/aspire.hosting/ireportingstep.md) -- The completed step.

## WarnAsync(IReportingTask, string?, CancellationToken)

- Name: `WarnAsync(IReportingTask, string?, CancellationToken)`
- Modifiers: `extension`
- Returns: [Task<IReportingTask>](/reference/api/csharp/aspire.hosting/ireportingtask.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/Publishing/PublishingExtensions.cs)

Completes a publishing task with a warning.

```csharp
public static class PublishingExtensions
{
    public static Task<IReportingTask> WarnAsync(
        this IReportingTask task,
        string? message = null,
        CancellationToken cancellationToken = default(CancellationToken))
    {
        // ...
    }
}
```

## Parameters

- `task` ([IReportingTask](/reference/api/csharp/aspire.hosting/ireportingtask.md))
  The task to complete.
- `message` (`string?`) `optional`
  Optional completion message.
- `cancellationToken` (`CancellationToken`) `optional`
  The cancellation token.

## Returns

[Task<IReportingTask>](/reference/api/csharp/aspire.hosting/ireportingtask.md) -- The completed task.

## WarnAsync(IReportingTask, MarkdownString, CancellationToken)

- Name: `WarnAsync(IReportingTask, MarkdownString, CancellationToken)`
- Modifiers: `extension`
- Returns: [Task<IReportingTask>](/reference/api/csharp/aspire.hosting/ireportingtask.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/Publishing/PublishingExtensions.cs)

Completes a publishing task with a warning and Markdown-formatted message.

```csharp
public static class PublishingExtensions
{
    public static Task<IReportingTask> WarnAsync(
        this IReportingTask task,
        MarkdownString message,
        CancellationToken cancellationToken = default(CancellationToken))
    {
        // ...
    }
}
```

## Parameters

- `task` ([IReportingTask](/reference/api/csharp/aspire.hosting/ireportingtask.md))
  The task to complete.
- `message` ([MarkdownString](/reference/api/csharp/aspire.hosting/markdownstring.md))
  The Markdown-formatted warning message.
- `cancellationToken` (`CancellationToken`) `optional`
  The cancellation token.

## Returns

[Task<IReportingTask>](/reference/api/csharp/aspire.hosting/ireportingtask.md) -- The completed task.
