TerminalResourceBuilderExtensions Methods
WithTerminal(IResourceBuilder<T>, Action<TerminalOptions>) Section titled WithTerminal(IResourceBuilder<T>, Action<TerminalOptions>)extensionIpublic static class TerminalResourceBuilderExtensions{ public static IResourceBuilder<T> WithTerminal<T>( this IResourceBuilder<T> builder, Action<TerminalOptions>? configure = null) { // ... }}Parameters
builderIconfigureAction<TerminalOptions> optionalAn optional callback to configure the terminal options.Returns
IResourceBuilder<T> A reference to the ApplicationModel.IResourceBuilder`1 for chaining additional configuration.Remarks
When a resource is configured with .With, DCP allocates a pseudo-terminal (PTY) per replica and a hidden terminal host process bridges the PTY traffic over Hex1b's HMP v1 protocol. The terminal session can be accessed from the Aspire Dashboard's terminal page or via the aspire terminal CLI command. When neither Terminal nor Terminal is configured, opening the dashboard terminal automatically fits the grid to the view. Explicit dimensions retain the producer's current grid until the viewer requests a resize. Terminal host resources can be revealed using the dashboard's Show hidden resources control to inspect their state and diagnostic telemetry. Terminal host telemetry is disabled when Distributed is true.
One terminal host process is spawned per parent replica (e.g. With → 3 terminal host processes named {parent}- .. {parent}-). The order of With and With does not matter: the per-replica hosts are materialized during Before after the model is fully built, so the final replica count is always honoured.
Examples
Add terminal support to an executable resource:
var agent = builder.AddExecutable("agent", "my-agent", ".") .WithTerminal();Add terminal support with custom dimensions to a multi-replica resource. The order of WithReplicas and WithTerminal does not matter:
var agent = builder.AddExecutable("agent", "my-agent", ".") .WithReplicas(3) .WithTerminal(options => { options.Columns = 200; options.Rows = 50; });