Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
In Aspire 13.0, the publishing activity reporter APIs and context types have been renamed to better reflect the pipeline architecture. The publishing step creation process has been simplified, with steps now automatically created during pipeline execution rather than requiring explicit creation within step actions.
Version introduced
Aspire 13.0 Preview 1
Previous behavior
The previous API used publishing-specific names and required explicit step creation within pipeline actions:
builder.Pipeline.AddStep("assign-storage-role", async (context) =>
{
var roleAssignmentStep = await context.ActivityReporter
.CreateStepAsync($"assign-storage-role", context.CancellationToken);
await using (roleAssignmentStep.ConfigureAwait(false))
{
var assignRoleTask = await roleAssignmentStep
.CreateTaskAsync($"Granting file share access...", context.CancellationToken);
await using (assignRoleTask.ConfigureAwait(false))
{
// ... task work
}
}
});
The types used were:
DeployingContext- Provided context for pipeline executionIPublishingActivityReporter- Interface for reporting activitiesPublishingActivityReporter- Implementation of the activity reporterNullPublishingActivityReporter- Null object pattern implementationIPublishingStep- Interface for publishing stepsIPublishingTask- Interface for publishing tasks
New behavior
The API now uses pipeline-specific names and automatically creates steps during pipeline execution:
builder.Pipeline.AddStep("assign-storage-role", async (stepContext) =>
{
var assignRoleTask = await stepContext.ReportingStep
.CreateTaskAsync($"Granting file share access...", stepContext.CancellationToken);
await using (assignRoleTask.ConfigureAwait(false))
{
// ... task work
}
});
The types have been renamed as follows:
DeployingContext→PipelineContext- Shared context across all pipeline stepsIPublishingActivityReporter→IPipelineActivityReporter- Interface for reporting pipeline activitiesPublishingActivityReporter→PipelineActivityReporter- Implementation of the pipeline activity reporterNullPublishingActivityReporter→NullPipelineActivityReporter- Null object pattern implementationIPublishingStep→IReportingStep- Interface for reporting stepsIPublishingTask→IReportingTask- Interface for reporting tasks
Additionally, a new PipelineStepContext type has been introduced that combines the shared PipelineContext with a step-specific IReportingStep, allowing each step to track its own tasks and completion state independently.
Type of breaking change
This change can affect binary compatibility and source compatibility.
Reason for change
The previous three-level hierarchy (ActivityReporter → Step → Task) was unnecessarily complex. The new architecture simplifies this by automatically creating steps during pipeline execution and integrating step management directly into the pipeline. This provides a cleaner separation between the shared pipeline context and step-specific execution context, making the API more intuitive and reducing boilerplate code.
Recommended action
Update your code to use the new type names and simplified step creation pattern:
- Replace
DeployingContextwithPipelineContextfor shared pipeline context orPipelineStepContextfor step-specific context. - Replace
IPublishingActivityReporterwithIPipelineActivityReporter. - Replace
PublishingActivityReporterwithPipelineActivityReporter. - Replace
NullPublishingActivityReporterwithNullPipelineActivityReporter. - Replace
IPublishingStepwithIReportingStep. - Replace
IPublishingTaskwithIReportingTask. - Update pipeline step actions to accept
PipelineStepContextinstead ofDeployingContext. - Remove explicit step creation calls within pipeline actions and use the automatically created
context.ReportingStepinstead.
Migration example:
// Before
builder.Pipeline.AddStep("my-step", async (context) =>
{
var step = await context.ActivityReporter
.CreateStepAsync("my-step", context.CancellationToken);
await using (step.ConfigureAwait(false))
{
var task = await step.CreateTaskAsync("Doing work...", context.CancellationToken);
await using (task.ConfigureAwait(false))
{
// Do work
await task.CompleteAsync("Done", CompletionState.Completed, context.CancellationToken);
}
}
});
// After
builder.Pipeline.AddStep("my-step", async (stepContext) =>
{
var task = await stepContext.ReportingStep
.CreateTaskAsync("Doing work...", stepContext.CancellationToken);
await using (task.ConfigureAwait(false))
{
// Do work
await task.CompleteAsync("Done", CompletionState.Completed, stepContext.CancellationToken);
}
});
Affected APIs
- Aspire.Hosting.ApplicationModel.DeployingContext
- Aspire.Hosting.Publishing.IPublishingActivityReporter
Aspire.Hosting.Publishing.PublishingActivityReporter- Aspire.Hosting.Publishing.NullPublishingActivityReporter
- Aspire.Hosting.Publishing.IPublishingStep
- Aspire.Hosting.Publishing.IPublishingTask
Aspire.Hosting.Publishing.PublishingStepAspire.Hosting.Publishing.PublishingTask- Aspire.Hosting.Publishing.PublishingExtensions