Skip to content
Docs Try Aspire
Docs Try

DistributedApplicationBuilderExtensions Methods

Class Methods 1 member
Extensions for the Hosting.IDistributedApplicationBuilder to add PowerShell runspace pool resources.
AddPowerShell(IDistributedApplicationBuilder, string, PSLanguageMode, int, int) Section titled AddPowerShell(IDistributedApplicationBuilder, string, PSLanguageMode, int, int) extension IResourceBuilder<PowerShellRunspacePoolResource>
Adds a PowerShell runspace pool resource to the distributed application, enabling managed execution of PowerShell scripts with configurable language mode and runspace limits.
public static class DistributedApplicationBuilderExtensions
{
public static IResourceBuilder<PowerShellRunspacePoolResource> AddPowerShell(
this IDistributedApplicationBuilder builder,
string name,
PSLanguageMode languageMode = 3,
int minRunspaces = 1,
int maxRunspaces = 5)
{
// ...
}
}
builder IDistributedApplicationBuilder The distributed application builder to which the PowerShell runspace pool resource will be added.
name string The name of the PowerShell runspace pool resource. Cannot be null or whitespace.
languageMode PSLanguageMode optional The language mode to use for the PowerShell runspace pool. Defaults to PSLanguageMode.ConstrainedLanguage.
minRunspaces int optional The minimum number of runspaces to maintain in the pool. Must be at least 1.
maxRunspaces int optional The maximum number of runspaces allowed in the pool. Must be greater than or equal to minRunspaces.
IResourceBuilder<PowerShellRunspacePoolResource> An IResourceBuilder instance for further configuration of the PowerShell runspace pool resource.
This overload is not ATS-compatible due to the use of PSLanguageMode. For ATS scenarios, use the string-based overload instead.