Share via


DistributedApplicationBuilder Class

Definition

A builder for creating instances of DistributedApplication.

public class DistributedApplicationBuilder : Aspire.Hosting.IDistributedApplicationBuilder
type DistributedApplicationBuilder = class
    interface IDistributedApplicationBuilder
Public Class DistributedApplicationBuilder
Implements IDistributedApplicationBuilder
Inheritance
DistributedApplicationBuilder
Implements

Remarks

The DistributedApplicationBuilder is the primary implementation of IDistributedApplicationBuilder within .NET Aspire. Typically a developer would interact with instances of this class via the IDistributedApplicationBuilder interface which was created using one of the CreateBuilder(String[]) overloads.

For more information on how to configure the DistributedApplication using the the builder pattern see IDistributedApplicationBuilder.

Constructors

DistributedApplicationBuilder(DistributedApplicationOptions)

Initializes a new instance of the DistributedApplicationBuilder class with the specified options.

DistributedApplicationBuilder(String[])

Initializes a new instance of the DistributedApplicationBuilder class with the specified options.

Properties

AppHostAssembly

Assembly of the app host project.

AppHostDirectory

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

Configuration System.Object.Configuration
Environment System.Object.Environment
Eventing

Eventing infrastructure for AppHost lifecycle.

ExecutionContext

Execution context for this invocation of the AppHost.

Resources

Gets the collection of resources for the distributed application.

Services System.Object.Services

Methods

AddResource<T>(T)

Adds a resource of type T to the distributed application.

Build()

Builds and returns a new DistributedApplication instance. This can only be called once.

CreateResourceBuilder<T>(T)

Creates a new resource builder based on an existing resource.

Extension Methods

AddAzureAppConfiguration(IDistributedApplicationBuilder, String, Action<IResourceBuilder<AzureAppConfigurationResource>,ResourceModuleConstruct, AppConfigurationStore>)

Adds an Azure App Configuration resource to the application model.

AddAzureAppConfiguration(IDistributedApplicationBuilder, String)

Adds an Azure App Configuration resource to the application model.

AddAzureApplicationInsights(IDistributedApplicationBuilder, String, IResourceBuilder<AzureLogAnalyticsWorkspaceResource>, Action<IResourceBuilder<AzureApplicationInsightsResource>, ResourceModuleConstruct,ApplicationInsightsComponent>)

Adds an Azure Application Insights resource to the application model.

AddAzureApplicationInsights(IDistributedApplicationBuilder, String, IResourceBuilder<AzureLogAnalyticsWorkspaceResource>)

Adds an Azure Application Insights resource to the application model.

AddAzureApplicationInsights(IDistributedApplicationBuilder, String, Action<IResourceBuilder<AzureApplicationInsightsResource>,ResourceModuleConstruct, ApplicationInsightsComponent>)

Adds an Azure Application Insights resource to the application model.

AddAzureApplicationInsights(IDistributedApplicationBuilder, String)

Adds an Azure Application Insights resource to the application model.

AddBicepTemplate(IDistributedApplicationBuilder, String, String)

Adds an Azure Bicep resource to the application model.

AddBicepTemplateString(IDistributedApplicationBuilder, String, String)

Adds an Azure Bicep resource to the application model.

AddAzureConstruct(IDistributedApplicationBuilder, String, Action<ResourceModuleConstruct>)

Adds an Azure construct resource to the application model.

AddAzureCosmosDB(IDistributedApplicationBuilder, String, Action<IResourceBuilder<AzureCosmosDBResource>, ResourceModuleConstruct,CosmosDBAccount,IEnumerable<CosmosDBSqlDatabase>>)

Adds an Azure Cosmos DB connection to the application model.

AddAzureCosmosDB(IDistributedApplicationBuilder, String)

Adds an Azure Cosmos DB connection to the application model.

AddAzureEventHubs(IDistributedApplicationBuilder, String, Action<IResourceBuilder<AzureEventHubsResource>, ResourceModuleConstruct,EventHubsNamespace>)

Adds an Azure Event Hubs Namespace resource to the application model. This resource can be used to create Event Hub resources.

AddAzureEventHubs(IDistributedApplicationBuilder, String)

Adds an Azure Event Hubs Namespace resource to the application model. This resource can be used to create Event Hub resources.

AddAzureKeyVault(IDistributedApplicationBuilder, String, Action<IResourceBuilder<AzureKeyVaultResource>,ResourceModuleConstruct,KeyVault>)

Adds an Azure Key Vault resource to the application model.

AddAzureKeyVault(IDistributedApplicationBuilder, String)

Adds an Azure Key Vault resource to the application model.

AddAzureLogAnalyticsWorkspace(IDistributedApplicationBuilder, String, Action<IResourceBuilder<AzureLogAnalyticsWorkspaceResource>, ResourceModuleConstruct,OperationalInsightsWorkspace>)

Adds an Azure Log Analytics Workspace resource to the application model.

AddAzureLogAnalyticsWorkspace(IDistributedApplicationBuilder, String)

Adds an Azure Application Insights resource to the application model.

AddAzureOpenAI(IDistributedApplicationBuilder, String, Action<IResourceBuilder<AzureOpenAIResource>, ResourceModuleConstruct,CognitiveServicesAccount,IEnumerable<CognitiveServicesAccountDeployment>>)

Adds an Azure OpenAI resource to the application model.

AddAzureOpenAI(IDistributedApplicationBuilder, String)

Adds an Azure OpenAI resource to the application model.

AddAzureProvisioning(IDistributedApplicationBuilder)

Adds support for generating azure resources dynamically during application startup. The application must configure the appropriate subscription, location.

AddAzureSearch(IDistributedApplicationBuilder, String, Action<IResourceBuilder<AzureSearchResource>,ResourceModuleConstruct,SearchService>)

Adds an Azure AI Search service resource to the application model.

AddAzureSearch(IDistributedApplicationBuilder, String)

Adds an Azure AI Search service resource to the application model.

AddAzureServiceBus(IDistributedApplicationBuilder, String, Action<IResourceBuilder<AzureServiceBusResource>, ResourceModuleConstruct,ServiceBusNamespace>)

Adds an Azure Service Bus Namespace resource to the application model. This resource can be used to create queue, topic, and subscription resources.

AddAzureServiceBus(IDistributedApplicationBuilder, String)

Adds an Azure Service Bus Namespace resource to the application model. This resource can be used to create queue, topic, and subscription resources.

AddAzureSignalR(IDistributedApplicationBuilder, String, Action<IResourceBuilder<AzureSignalRResource>,ResourceModuleConstruct,SignalRService>)

Adds an Azure SignalR resource to the application model.

AddAzureSignalR(IDistributedApplicationBuilder, String)

Adds an Azure SignalR resource to the application model.

AddAzureStorage(IDistributedApplicationBuilder, String, Action<IResourceBuilder<AzureStorageResource>,ResourceModuleConstruct,StorageAccount>)

Adds an Azure Storage resource to the application model.This resource can be used to create Azure blob, table, and queue resources.

AddAzureStorage(IDistributedApplicationBuilder, String)

Adds an Azure Storage resource to the application model.This resource can be used to create Azure blob, table, and queue resources.

AddAzureWebPubSub(IDistributedApplicationBuilder, String, Action<IResourceBuilder<AzureWebPubSubResource>,ResourceModuleConstruct,WebPubSubService>)

Adds an Azure Web PubSub resource to the application model.

AddAzureWebPubSub(IDistributedApplicationBuilder, String)

Adds an Azure Web PubSub resource to the application model. Change sku: WithParameter("sku", "Standard_S1") Change capacity: WithParameter("capacity", 2)

AddAWSCloudFormationStack(IDistributedApplicationBuilder, String)

Add a CloudFormation stack for provisioning application resources.

AddAWSCloudFormationTemplate(IDistributedApplicationBuilder, String, String)

Add a CloudFormation stack for provisioning application resources.

AddContainer(IDistributedApplicationBuilder, String, String, String)

Adds a container resource to the application.

AddContainer(IDistributedApplicationBuilder, String, String)

Adds a container resource to the application. Uses the "latest" tag.

AddDockerfile(IDistributedApplicationBuilder, String, String, String, String)

Adds a Dockerfile to the application model that can be treated like a container resource.

AddElasticsearch(IDistributedApplicationBuilder, String, IResourceBuilder<ParameterResource>, Nullable<Int32>)

Adds an Elasticsearch container resource to the application model.

AddExecutable(IDistributedApplicationBuilder, String, String, String, String[])

Adds an executable resource to the application model.

AddGarnet(IDistributedApplicationBuilder, String, Nullable<Int32>)

Adds a Garnet container to the application model.

AddDapr(IDistributedApplicationBuilder, Action<DaprOptions>)

Adds Dapr support to Aspire, including the ability to add Dapr sidecar to application resource.

AddDaprComponent(IDistributedApplicationBuilder, String, String, DaprComponentOptions)

Adds a Dapr component to the application model.

AddDaprPubSub(IDistributedApplicationBuilder, String, DaprComponentOptions)

Adds a "generic" Dapr pub-sub component to the application model. Aspire will configure an appropriate type when running or deploying.

AddDaprStateStore(IDistributedApplicationBuilder, String, DaprComponentOptions)

Adds a Dapr state store component to the application model. Aspire will configure an appropriate type when running or deploying.

AddKafka(IDistributedApplicationBuilder, String, Nullable<Int32>)

Adds a Kafka resource to the application. A container is used for local development. This version the package defaults to the 7.6.1 tag of the confluentinc/confluent-local container image.

AddKeycloak(IDistributedApplicationBuilder, String, Nullable<Int32>, IResourceBuilder<ParameterResource>, IResourceBuilder<ParameterResource>)

Adds a Keycloak container to the application model.

AddMilvus(IDistributedApplicationBuilder, String, IResourceBuilder<ParameterResource>, Nullable<Int32>)

Adds a Milvus resource to the application. A container is used for local development.

AddMongoDB(IDistributedApplicationBuilder, String, Nullable<Int32>)

Adds a MongoDB resource to the application model. A container is used for local development. This version the package defaults to the 7.0.8 tag of the mongo container image.

AddMySql(IDistributedApplicationBuilder, String, IResourceBuilder<ParameterResource>, Nullable<Int32>)

Adds a MySQL server resource to the application model. For local development a container is used. This version the package defaults to the 8.3.0 tag of the mysql container image

AddNats(IDistributedApplicationBuilder, String, Nullable<Int32>)

Adds a NATS server resource to the application model. A container is used for local development.

AddNodeApp(IDistributedApplicationBuilder, String, String, String, String[])

Adds a node application to the application model. Node should available on the PATH.

AddNpmApp(IDistributedApplicationBuilder, String, String, String, String[])

Adds a node application to the application model. Executes the npm command with the specified script name.

AddOracle(IDistributedApplicationBuilder, String, IResourceBuilder<ParameterResource>, Nullable<Int32>)

Adds a Oracle Server resource to the application model. A container is used for local development. This version the package defaults to the 23.3.0.0 tag of the container-registry.oracle.com/database/free container image

AddOrleans(IDistributedApplicationBuilder, String)

Adds an Orleans service to the application.

AddConnectionString(IDistributedApplicationBuilder, String, String)

Adds a parameter to the distributed application but wrapped in a resource with a connection string for use with WithReference<TDestination>(IResourceBuilder<TDestination>, IResourceBuilder<IResourceWithConnectionString>, String, Boolean)

AddParameter(IDistributedApplicationBuilder, String, Boolean)

Adds a parameter resource to the application.

AddPostgres(IDistributedApplicationBuilder, String, IResourceBuilder<ParameterResource>, IResourceBuilder<ParameterResource>, Nullable<Int32>)

Adds a PostgreSQL resource to the application model. A container is used for local development. This version the package defaults to the 16.2 tag of the postgres container image

AddProject(IDistributedApplicationBuilder, String, String, Action<ProjectResourceOptions>)

Adds a .NET project to the application model.

AddProject(IDistributedApplicationBuilder, String, String, String)

Adds a .NET project to the application model.

AddProject(IDistributedApplicationBuilder, String, String)

Adds a .NET project to the application model.

AddProject<TProject>(IDistributedApplicationBuilder, String, Action<ProjectResourceOptions>)

Adds a .NET project to the application model.

AddProject<TProject>(IDistributedApplicationBuilder, String, String)

Adds a .NET project to the application model. By default, this will exist in a Projects namespace. e.g. Projects.MyProject. If the project is not in a Projects namespace, make sure a project reference is added from the AppHost project to the target project.

AddProject<TProject>(IDistributedApplicationBuilder, String)

Adds a .NET project to the application model.

AddPythonProject(IDistributedApplicationBuilder, String, String, String, String, String[])

Adds a python application with a virtual environment to the application model.

AddPythonProject(IDistributedApplicationBuilder, String, String, String, String[])

Adds a python application with a virtual environment to the application model.

AddQdrant(IDistributedApplicationBuilder, String, IResourceBuilder<ParameterResource>, Nullable<Int32>, Nullable<Int32>)

Adds a Qdrant resource to the application. A container is used for local development.

AddRabbitMQ(IDistributedApplicationBuilder, String, IResourceBuilder<ParameterResource>, IResourceBuilder<ParameterResource>, Nullable<Int32>)

Adds a RabbitMQ container to the application model.

AddRedis(IDistributedApplicationBuilder, String, Nullable<Int32>)

Adds a Redis container to the application model.

AddAWSSDKConfig(IDistributedApplicationBuilder)

Add a configuration for resolving region and credentials for the AWS SDK for .NET.

AddSeq(IDistributedApplicationBuilder, String, Nullable<Int32>)

Adds a Seq server resource to the application model. A container is used for local development.

AddSqlServer(IDistributedApplicationBuilder, String, IResourceBuilder<ParameterResource>, Nullable<Int32>)

Adds a SQL Server resource to the application model. A container is used for local development.

AddValkey(IDistributedApplicationBuilder, String, Nullable<Int32>)

Adds a Valkey container to the application model.

Applies to