# DistributedApplicationBuilder Properties

- Package: [Aspire.Hosting](/reference/api/csharp/aspire.hosting.md)
- Type: [DistributedApplicationBuilder](/reference/api/csharp/aspire.hosting/distributedapplicationbuilder.md)
- Kind: `Properties`
- Members: `12`

A builder for creating instances of [DistributedApplication](/reference/api/csharp/aspire.hosting/distributedapplication.md).

## AppHostAssembly

- Name: `AppHostAssembly`
- Modifiers: `nullable` `get`
- Returns: `Assembly?`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/DistributedApplicationBuilder.cs#L90)

Assembly of the app host project.

```csharp
public Assembly? AppHostAssembly { get; }
```

## AppHostDirectory

- Name: `AppHostDirectory`
- Modifiers: `get`
- Returns: `string`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/DistributedApplicationBuilder.cs#L84)

Directory of the project where the app host is located. Defaults to the content root if there's no project.

```csharp
public string AppHostDirectory { get; }
```

## AppHostPath

- Name: `AppHostPath`
- Modifiers: `get`
- Returns: `string`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/DistributedApplicationBuilder.cs#L87)

```csharp
public string AppHostPath { get; }
```

## Configuration

- Name: `Configuration`
- Modifiers: `get`
- Returns: `ConfigurationManager`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/DistributedApplicationBuilder.cs#L78)

Gets the set of key/value configuration properties.

```csharp
public ConfigurationManager Configuration { get; }
```

## Remarks

This can be mutated by adding more configuration sources, which will update its current view.

## Environment

- Name: `Environment`
- Modifiers: `get`
- Returns: `IHostEnvironment`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/DistributedApplicationBuilder.cs#L75)

Gets the information about the hosting environment an application is running in.

```csharp
public IHostEnvironment Environment { get; }
```

## Eventing

- Name: `Eventing`
- Modifiers: `get`
- Returns: [IDistributedApplicationEventing](/reference/api/csharp/aspire.hosting/idistributedapplicationeventing.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/DistributedApplicationBuilder.cs#L99)

Eventing infrastructure for AppHost lifecycle.

```csharp
public IDistributedApplicationEventing Eventing { get; }
```

## ExecutionContext

- Name: `ExecutionContext`
- Modifiers: `get`
- Returns: [DistributedApplicationExecutionContext](/reference/api/csharp/aspire.hosting/distributedapplicationexecutioncontext.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/DistributedApplicationBuilder.cs#L93)

Execution context for this invocation of the AppHost.

```csharp
public DistributedApplicationExecutionContext ExecutionContext { get; }
```

## Remarks

The [IDistributedApplicationBuilder.ExecutionContext](/reference/api/csharp/aspire.hosting/idistributedapplicationbuilder/properties.md#executioncontext) property provides access key information about the context in which the distributed application is running. The most important properties that the [DistributedApplicationExecutionContext](/reference/api/csharp/aspire.hosting/distributedapplicationexecutioncontext.md) provides is the [DistributedApplicationExecutionContext.IsPublishMode](/reference/api/csharp/aspire.hosting/distributedapplicationexecutioncontext/properties.md#ispublishmode) and [DistributedApplicationExecutionContext.IsRunMode](/reference/api/csharp/aspire.hosting/distributedapplicationexecutioncontext/properties.md#isrunmode) properties. Developers building Aspire based applications may whish to change the application model depending on whether they are running locally, or whether they are publishing to the cloud.

An example of using the [DistributedApplicationExecutionContext.IsRunMode](/reference/api/csharp/aspire.hosting/distributedapplicationexecutioncontext/properties.md#isrunmode) property on the [IDistributedApplicationBuilder](/reference/api/csharp/aspire.hosting/idistributedapplicationbuilder.md) via the `IResourceBuilder`1.ApplicationBuilder`. In this case an extension method is used to generate a stable node name for RabbitMQ for local development runs.

```csharp
private static IResourceBuilder<RabbitMQServerResource> RunWithStableNodeName(this IResourceBuilder<RabbitMQServerResource> builder)
{
    if (builder.ApplicationBuilder.ExecutionContext.IsRunMode)
    {
        builder.WithEnvironment(context =>
        {
            // Set a stable node name so queue storage is consistent between sessions
            var nodeName = $"{builder.Resource.Name}@localhost";
            context.EnvironmentVariables["RABBITMQ_NODENAME"] = nodeName;
        });
    }

    return builder;
}
```

## FileSystemService

- Name: `FileSystemService`
- Modifiers: `get`
- Returns: [IFileSystemService](/reference/api/csharp/aspire.hosting/ifilesystemservice.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/DistributedApplicationBuilder.cs#L105)

Gets the service for managing Aspire file system operations.

```csharp
public IFileSystemService FileSystemService { get; }
```

## Remarks

The [IDistributedApplicationBuilder.FileSystemService](/reference/api/csharp/aspire.hosting/idistributedapplicationbuilder/properties.md#filesystemservice) provides a centralized way to manage temporary files and directories used by Aspire, enabling testability and consistent temp file management.

Resources and infrastructure code should use this service instead of static methods like `Path.GetTempPath` or `Directory.CreateTempSubdirectory` to ensure consistent directory management across the application.

## Pipeline

- Name: `Pipeline`
- Modifiers: `get`
- Returns: [IDistributedApplicationPipeline](/reference/api/csharp/aspire.hosting/idistributedapplicationpipeline.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/DistributedApplicationBuilder.cs#L102)

Gets the deployment pipeline for this distributed application.

```csharp
public IDistributedApplicationPipeline Pipeline { get; }
```

## Remarks

The pipeline allows adding custom deployment steps that execute during the deploy process. Steps can declare dependencies on other steps to control execution order.

## Resources

- Name: `Resources`
- Modifiers: `get`
- Returns: [IResourceCollection](/reference/api/csharp/aspire.hosting/iresourcecollection.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/DistributedApplicationBuilder.cs#L96)

Gets the collection of resources for the distributed application.

```csharp
public IResourceCollection Resources { get; }
```

## Remarks

This can be mutated by adding more resources, which will update its current view.

## Services

- Name: `Services`
- Modifiers: `get`
- Returns: `IServiceCollection`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/DistributedApplicationBuilder.cs#L81)

Gets a collection of services for the application to compose. This is useful for adding user provided or framework provided services.

```csharp
public IServiceCollection Services { get; }
```

## UserSecretsManager

- Name: `UserSecretsManager`
- Modifiers: `get`
- Returns: [IUserSecretsManager](/reference/api/csharp/aspire.hosting/iusersecretsmanager.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/DistributedApplicationBuilder.cs#L108)

Gets the service for managing user secrets.

```csharp
public IUserSecretsManager UserSecretsManager { get; }
```

## Remarks

The [IDistributedApplicationBuilder.UserSecretsManager](/reference/api/csharp/aspire.hosting/idistributedapplicationbuilder/properties.md#usersecretsmanager) provides a centralized way to manage user secrets used by Aspire, enabling testability and consistent secret management.
