# PipelineStepExtensions Methods

- Package: [Aspire.Hosting](/reference/api/csharp/aspire.hosting.md)
- Type: [PipelineStepExtensions](/reference/api/csharp/aspire.hosting/pipelinestepextensions.md)
- Kind: `Methods`
- Members: `6`

Extension methods for pipeline steps.

## DependsOn(IEnumerable<PipelineStep>, PipelineStep?)

- Name: `DependsOn(IEnumerable<PipelineStep>, PipelineStep?)`
- Modifiers: `extension`
- Returns: [IEnumerable<PipelineStep>](/reference/api/csharp/aspire.hosting/pipelinestep.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/Pipelines/PipelineStepExtensions.cs#L23-L33)

Makes each step in the collection depend on the specified step.

```csharp
public static class PipelineStepExtensions
{
    public static IEnumerable<PipelineStep> DependsOn(
        this IEnumerable<PipelineStep> steps,
        PipelineStep? step)
    {
        // ...
    }
}
```

## Parameters

- `steps` ([IEnumerable<PipelineStep>](/reference/api/csharp/aspire.hosting/pipelinestep.md))
  The collection of steps.
- `step` ([PipelineStep?](/reference/api/csharp/aspire.hosting/pipelinestep.md))
  The step to depend on.

## Returns

[IEnumerable<PipelineStep>](/reference/api/csharp/aspire.hosting/pipelinestep.md) -- The original collection of steps.

## ATS metadata

### Ignored by ATS

- Reason: Use PipelineStep.dependsOn on each step in the collection, or mutate PipelineStep.dependsOnSteps directly.

## DependsOn(IEnumerable<PipelineStep>, string)

- Name: `DependsOn(IEnumerable<PipelineStep>, string)`
- Modifiers: `extension`
- Returns: [IEnumerable<PipelineStep>](/reference/api/csharp/aspire.hosting/pipelinestep.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/Pipelines/PipelineStepExtensions.cs#L45-L55)

Makes each step in the collection depend on the specified step name.

```csharp
public static class PipelineStepExtensions
{
    public static IEnumerable<PipelineStep> DependsOn(
        this IEnumerable<PipelineStep> steps,
        string stepName)
    {
        // ...
    }
}
```

## Parameters

- `steps` ([IEnumerable<PipelineStep>](/reference/api/csharp/aspire.hosting/pipelinestep.md))
  The collection of steps.
- `stepName` (`string`)
  The name of the step to depend on.

## Returns

[IEnumerable<PipelineStep>](/reference/api/csharp/aspire.hosting/pipelinestep.md) -- The original collection of steps.

## ATS metadata

### Ignored by ATS

- Reason: Use PipelineStep.dependsOn on each step in the collection, or mutate PipelineStep.dependsOnSteps directly.

## DependsOn(IEnumerable<PipelineStep>, IEnumerable<PipelineStep>)

- Name: `DependsOn(IEnumerable<PipelineStep>, IEnumerable<PipelineStep>)`
- Modifiers: `extension`
- Returns: [IEnumerable<PipelineStep>](/reference/api/csharp/aspire.hosting/pipelinestep.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/Pipelines/PipelineStepExtensions.cs#L67-L75)

Makes each step in the collection depend on the specified target steps.

```csharp
public static class PipelineStepExtensions
{
    public static IEnumerable<PipelineStep> DependsOn(
        this IEnumerable<PipelineStep> steps,
        IEnumerable<PipelineStep> targetSteps)
    {
        // ...
    }
}
```

## Parameters

- `steps` ([IEnumerable<PipelineStep>](/reference/api/csharp/aspire.hosting/pipelinestep.md))
  The collection of steps.
- `targetSteps` ([IEnumerable<PipelineStep>](/reference/api/csharp/aspire.hosting/pipelinestep.md))
  The target steps to depend on.

## Returns

[IEnumerable<PipelineStep>](/reference/api/csharp/aspire.hosting/pipelinestep.md) -- The original collection of steps.

## ATS metadata

### Ignored by ATS

- Reason: Use PipelineStep.dependsOn on each step in the collection, or mutate PipelineStep.dependsOnSteps directly.

## RequiredBy(IEnumerable<PipelineStep>, PipelineStep?)

- Name: `RequiredBy(IEnumerable<PipelineStep>, PipelineStep?)`
- Modifiers: `extension`
- Returns: [IEnumerable<PipelineStep>](/reference/api/csharp/aspire.hosting/pipelinestep.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/Pipelines/PipelineStepExtensions.cs#L87-L97)

Specifies that each step in the collection is required by the specified step.

```csharp
public static class PipelineStepExtensions
{
    public static IEnumerable<PipelineStep> RequiredBy(
        this IEnumerable<PipelineStep> steps,
        PipelineStep? step)
    {
        // ...
    }
}
```

## Parameters

- `steps` ([IEnumerable<PipelineStep>](/reference/api/csharp/aspire.hosting/pipelinestep.md))
  The collection of steps.
- `step` ([PipelineStep?](/reference/api/csharp/aspire.hosting/pipelinestep.md))
  The step that requires these steps.

## Returns

[IEnumerable<PipelineStep>](/reference/api/csharp/aspire.hosting/pipelinestep.md) -- The original collection of steps.

## ATS metadata

### Ignored by ATS

- Reason: Use PipelineStep.requiredBy on each step in the collection, or mutate PipelineStep.requiredBySteps directly.

## RequiredBy(IEnumerable<PipelineStep>, string)

- Name: `RequiredBy(IEnumerable<PipelineStep>, string)`
- Modifiers: `extension`
- Returns: [IEnumerable<PipelineStep>](/reference/api/csharp/aspire.hosting/pipelinestep.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/Pipelines/PipelineStepExtensions.cs#L109-L119)

Specifies that each step in the collection is required by the specified step name.

```csharp
public static class PipelineStepExtensions
{
    public static IEnumerable<PipelineStep> RequiredBy(
        this IEnumerable<PipelineStep> steps,
        string stepName)
    {
        // ...
    }
}
```

## Parameters

- `steps` ([IEnumerable<PipelineStep>](/reference/api/csharp/aspire.hosting/pipelinestep.md))
  The collection of steps.
- `stepName` (`string`)
  The name of the step that requires these steps.

## Returns

[IEnumerable<PipelineStep>](/reference/api/csharp/aspire.hosting/pipelinestep.md) -- The original collection of steps.

## ATS metadata

### Ignored by ATS

- Reason: Use PipelineStep.requiredBy on each step in the collection, or mutate PipelineStep.requiredBySteps directly.

## RequiredBy(IEnumerable<PipelineStep>, IEnumerable<PipelineStep>)

- Name: `RequiredBy(IEnumerable<PipelineStep>, IEnumerable<PipelineStep>)`
- Modifiers: `extension`
- Returns: [IEnumerable<PipelineStep>](/reference/api/csharp/aspire.hosting/pipelinestep.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/Pipelines/PipelineStepExtensions.cs#L131-L139)

Specifies that each step in the collection is required by the specified target steps.

```csharp
public static class PipelineStepExtensions
{
    public static IEnumerable<PipelineStep> RequiredBy(
        this IEnumerable<PipelineStep> steps,
        IEnumerable<PipelineStep> targetSteps)
    {
        // ...
    }
}
```

## Parameters

- `steps` ([IEnumerable<PipelineStep>](/reference/api/csharp/aspire.hosting/pipelinestep.md))
  The collection of steps.
- `targetSteps` ([IEnumerable<PipelineStep>](/reference/api/csharp/aspire.hosting/pipelinestep.md))
  The target steps that require these steps.

## Returns

[IEnumerable<PipelineStep>](/reference/api/csharp/aspire.hosting/pipelinestep.md) -- The original collection of steps.

## ATS metadata

### Ignored by ATS

- Reason: Use PipelineStep.requiredBy on each step in the collection, or mutate PipelineStep.requiredBySteps directly.
