# IDistributedApplicationTestingBuilder Properties

- Package: [Aspire.Hosting.Testing](/reference/api/csharp/aspire.hosting.testing.md)
- Type: [IDistributedApplicationTestingBuilder](/reference/api/csharp/aspire.hosting.testing/idistributedapplicationtestingbuilder.md)
- Kind: `Properties`
- Members: `11`

A builder for creating instances of `Hosting.DistributedApplication` for testing purposes.

## AppHostAssembly

- Name: `AppHostAssembly`
- Modifiers: `virtual` `nullable` `get`
- Returns: `Assembly?`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.Testing/DistributedApplicationTestingBuilder.cs#L475)

Assembly of the app host project.

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

## AppHostDirectory

- Name: `AppHostDirectory`
- Modifiers: `virtual` `get`
- Returns: `string`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.Testing/DistributedApplicationTestingBuilder.cs#L472)

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

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

## Configuration

- Name: `Configuration`
- Modifiers: `virtual` `get`
- Returns: `ConfigurationManager`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.Testing/DistributedApplicationTestingBuilder.cs#L469)

Gets the set of key/value configuration properties.

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

## Remarks

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

## Environment

- Name: `Environment`
- Modifiers: `virtual` `get`
- Returns: `IHostEnvironment`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.Testing/DistributedApplicationTestingBuilder.cs#L478)

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

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

## Eventing

- Name: `Eventing`
- Modifiers: `virtual` `get`
- Returns: `IDistributedApplicationEventing`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.Testing/DistributedApplicationTestingBuilder.cs#L487)

Eventing infrastructure for AppHost lifecycle.

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

## ExecutionContext

- Name: `ExecutionContext`
- Modifiers: `virtual` `get`
- Returns: `DistributedApplicationExecutionContext`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.Testing/DistributedApplicationTestingBuilder.cs#L484)

Execution context for this invocation of the AppHost.

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

## Remarks

The `IDistributedApplicationBuilder.ExecutionContext` property provides access key information about the context in which the distributed application is running. The most important properties that the `Hosting.DistributedApplicationExecutionContext` provides is the `DistributedApplicationExecutionContext.IsPublishMode` and `DistributedApplicationExecutionContext.IsRunMode` properties. Developers building .NET 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.

## Examples

An example of using the `DistributedApplicationExecutionContext.IsRunMode` property on the `Hosting.IDistributedApplicationBuilder` 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: `virtual` `get`
- Returns: `IFileSystemService`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.Testing/DistributedApplicationTestingBuilder.cs#L496)

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

## Pipeline

- Name: `Pipeline`
- Modifiers: `virtual` `get`
- Returns: `IDistributedApplicationPipeline`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.Testing/DistributedApplicationTestingBuilder.cs#L490)

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

## Resources

- Name: `Resources`
- Modifiers: `virtual` `get`
- Returns: `IResourceCollection`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.Testing/DistributedApplicationTestingBuilder.cs#L493)

Gets the collection of resources for the distributed application.

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

## Remarks

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

## Services

- Name: `Services`
- Modifiers: `virtual` `get`
- Returns: `IServiceCollection`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.Testing/DistributedApplicationTestingBuilder.cs#L481)

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

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

## UserSecretsManager

- Name: `UserSecretsManager`
- Modifiers: `virtual` `get`
- Returns: `IUserSecretsManager`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.Testing/DistributedApplicationTestingBuilder.cs#L499)

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