ExecutionConfigurationBuilder.Create(IResource) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Creates a new instance of IExecutionConfigurationBuilder.
public static Aspire.Hosting.ApplicationModel.IExecutionConfigurationBuilder Create(Aspire.Hosting.ApplicationModel.IResource resource);
static member Create : Aspire.Hosting.ApplicationModel.IResource -> Aspire.Hosting.ApplicationModel.IExecutionConfigurationBuilder
Public Shared Function Create (resource As IResource) As IExecutionConfigurationBuilder
Parameters
- resource
- IResource
The resource to build the configuration for.
Returns
A new IExecutionConfigurationBuilder.
Remarks
This method is useful for building resource execution configurations (command line arguments and environment variables) in a fluent manner. Individual configuration sources can be added to the builder before finalizing the configuration to allow only supported configuration sources to be applied in a given execution context (run vs. publish, etc).
In particular, this is used to allow certificate-related features to contribute to the final config, but only in execution contexts where they're supported.
var resolvedConfiguration = await ExecutionConfigurationBuilder
.Create(myResource)
.WithArgumentsConfig()
.WithEnvironmentVariablesConfig()
.BuildAsync(executionContext)
.ConfigureAwait(false);
foreach (var argument in resolvedConfiguration.Arguments)
{
Console.WriteLine($"Argument: {argument.Value}");
}