ExecutionConfigurationBuilder
IExecutionConfigurationResult for a specific resource in the distributed application model. This resolves command line arguments and environment variables and potentially additional metadata through registered gatherers. namespace Aspire.Hosting.ApplicationModel;
public sealed class ExecutionConfigurationBuilder : Aspire.Hosting.ApplicationModel.IExecutionConfigurationBuilder{ // ...}Remarks
Section titled Remarks Use ExecutionConfigurationBuilder when you need to programmatically assemble configuration for a resource, typically by aggregating multiple configuration sources using the gatherer pattern. This builder collects configuration from registered IExecutionConfigurationGatherer instances, which encapsulate logic for gathering resource-specific command line arguments, environment variables, and other metadata.
The gatherer pattern allows for modular and extensible configuration assembly, where each gatherer can contribute part of the final configuration and allows for collecting only the relevant configuration supported in a given context (i.e. only applying certificate configuration gatherers in supported environments).
Typical usage involves creating a builder for a resource, adding one or more configuration gatherers, and then building the configuration asynchronously.
Methods3
Section titled MethodsAddExecutionConfigurationGatherer(IExecutionConfigurationGatherer)BuildAsync(DistributedApplicationExecutionContext, ILogger?, CancellationToken)Create(IResource)staticIExecutionConfigurationBuilder. Examples
Section titled Examplesvar resolvedConfiguration = await ExecutionConfigurationBuilder .Create(myResource); .WithArgumentsConfig() .WithEnvironmentVariablesConfig() .BuildAsync(executionContext).ConfigureAwait(false);