Skip to content
Docs Try Aspire

Aspire.Hosting

Official
📦 Aspire.Hosting v13.2.0-preview.1.26159.1
140 Functions
72 Types

Types

handle AspireClient 7 members
handle AspireDict 9 members
handle AspireList 6 members
type AtsError 4 fields
type AtsErrorDetails 3 fields
handle CancellationToken
handle CapabilityError 3 members
handle CommandLineArgsCallbackContext 4 members
type CommandOptions 7 fields
handle ConnectionStringResource
handle ContainerRegistryResource
handle ContainerResource 18 members
type CreateBuilderOptions 8 fields
handle CSharpAppResource
handle DistributedApplication 1 members
handle DistributedApplicationEventSubscription
handle DistributedApplicationExecutionContext 5 members
handle DistributedApplicationExecutionContextOptions
handle DistributedApplicationResourceEventSubscription
handle DotnetToolResource 6 members
handle EndpointReference 13 members
handle EndpointReferenceExpression 3 members
handle EnvironmentCallbackContext 3 members
handle ExecutableResource 4 members
handle ExecuteCommandContext 4 members
type ExecuteCommandResult 3 fields
handle ExternalServiceResource 1 members
handle Handle 4 members
interface IConfiguration 2 members
interface IDistributedApplicationBuilder 18 members
interface IDistributedApplicationEvent
interface IDistributedApplicationEventing 1 members
interface IDistributedApplicationResourceEvent
interface IHostEnvironment 2 members
interface IResource 22 members
interface IResourceWithArgs 3 members
interface IResourceWithConnectionString 2 members
interface IResourceWithContainerFiles 2 members
interface IResourceWithEndpoints 10 members
interface IResourceWithEnvironment 19 members
interface IResourceWithParent
interface IResourceWithServiceDiscovery
interface IResourceWithWaitSupport 5 members
interface IServiceProvider 2 members
type MarshalledHandle 2 fields
handle ParameterResource 1 members
handle PipelineConfigurationContext 3 members
handle PipelineStep 12 members
handle PipelineStepContext 2 members
handle ProjectResource 2 members
handle ProjectResourceOptions 6 members
handle ReferenceExpression
handle ReferenceExpressionBuilder 5 members
handle ResourceBuilderBase 1 members
type ResourceEventDto 6 fields
handle ResourceLoggerService 2 members
handle ResourceNotificationService 6 members
type ResourceUrlAnnotation 4 fields
handle ResourceUrlsCallbackContext 3 members
handle UpdateCommandStateContext

Functions

function addConnectionString builder
Adds a connection string resource
addConnectionString(name: string, environmentVariableName?: string): IResourceWithConnectionString
function addConnectionStringBuilder builder
Adds a connection string with a builder callback
addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => void): ConnectionStringResource
function addContainer builder
Adds a container resource
addContainer(name: string, image: string): ContainerResource
function addContainerRegistry builder
Adds a container registry resource
addContainerRegistry(name: string, endpoint: ParameterResource, repository?: ParameterResource): ContainerRegistryResource
function addCSharpApp builder
Adds a C# application resource
addCSharpApp(name: string, path: string): ProjectResource
function addCSharpAppWithOptions builder
Adds a C# application resource with configuration options
addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => void): CSharpAppResource
function addDockerfile builder
Adds a container resource built from a Dockerfile
addDockerfile(name: string, contextPath: string, dockerfilePath?: string, stage?: string): ContainerResource
function addDotnetTool builder
Adds a .NET tool resource
addDotnetTool(name: string, packageId: string): DotnetToolResource
function addExecutable builder
Adds an executable resource
addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResource
function addExternalService builder
Adds an external service resource
addExternalService(name: string, url: string): ExternalServiceResource
function addParameter builder
Adds a parameter resource
addParameter(name: string, secret?: boolean): ParameterResource
function addParameterFromConfiguration builder
Adds a parameter sourced from configuration
addParameterFromConfiguration(name: string, configurationKey: string, secret?: boolean): ParameterResource
function addProject builder
Adds a .NET project resource
addProject(name: string, projectPath: string, launchProfileName: string): ProjectResource
function addProjectWithOptions builder
Adds a project resource with configuration options
addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => void): ProjectResource
function asHttp2Service builder
Configures resource for HTTP/2
asHttp2Service(): IResourceWithEndpoints
function clearContainerFilesSources builder
Clears all container file sources
clearContainerFilesSources(): IResourceWithContainerFiles
function completeLog
Completes the log stream for a resource
completeLog(resource: IResource): void
function completeLogByName
Completes the log stream by resource name
completeLogByName(resourceName: string): void
function createBuilder
Creates a new distributed application builder
createBuilder(): IDistributedApplicationBuilder
function createBuilderWithOptions
Creates builder with options
createBuilderWithOptions(): IDistributedApplicationBuilder
function disableForwardedHeaders builder
Disables forwarded headers for the project
disableForwardedHeaders(): ProjectResource
function excludeFromManifest builder
Excludes the resource from the deployment manifest
excludeFromManifest(): IResource
function excludeFromMcp builder
Excludes the resource from MCP server exposure
excludeFromMcp(): IResource
function getConfigValue
Gets a configuration value by key
getConfigValue(key: string): string
function getConnectionString
Gets a connection string by name
getConnectionString(name: string): string
function getEndpoint
Gets an endpoint reference
getEndpoint(name: string): EndpointReference
function getEnvironmentName
Gets the environment name
getEnvironmentName(): string
function getRequiredService
Gets a required service by ATS type ID
getRequiredService(typeId: string): any
function getResourceName
Gets the resource name
getResourceName(): string
function getService
Gets a service by ATS type ID
getService(typeId: string): any
function isAtsError
Type guard to check if a value is an ATS error response.
isAtsError(value: unknown): value is { $error: AtsError }
function isDevelopment
Checks if running in Development environment
isDevelopment(): boolean
function isMarshalledHandle
Type guard to check if a value is a marshalled handle.
isMarshalledHandle(value: unknown): value is MarshalledHandle
function log
Logs a message with specified level
log(level: string, message: string): void
function logDebug
Logs a debug message
logDebug(message: string): void
function logError
Logs an error message
logError(message: string): void
function logInformation
Logs an information message
logInformation(message: string): void
function logWarning
Logs a warning message
logWarning(message: string): void
function publishAsConnectionString builder
Publishes the resource as a connection string
publishAsConnectionString(): ContainerResource
function publishAsContainer builder
Configures the resource to be published as a container
publishAsContainer(): ContainerResource
function publishAsDockerFile builder
Publishes the executable as a Docker container
publishAsDockerFile(): ExecutableResource
function publishAsDockerFileWithConfigure builder
Publishes an executable as a Docker file with optional container configuration
publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => void): ExecutableResource
function publishResourceUpdate
Publishes an update for a resource's state
publishResourceUpdate(resource: IResource, state?: string, stateStyle?: string): void
function publishWithContainerFiles builder
Configures the resource to copy container files from the specified source during publishing
publishWithContainerFiles(source: IResourceWithContainerFiles, destinationPath: string): IContainerFilesDestinationResource
function refExpr
Tagged template function for creating reference expressions that reference endpoints, parameters, and other value providers.
refExpr(strings: TemplateStringsArray, ...values: unknown[]): ReferenceExpression
function registerCallback
Register a callback function that can be invoked from the .NET side. Returns a callback ID.
registerCallback<TResult>(callback: (...args: any[]) => TResult | Promise<TResult>): string
function registerCancellation
Register an AbortSignal for cancellation support. Returns a cancellation ID for methods accepting CancellationToken.
registerCancellation(signal?: AbortSignal): string | undefined
function registerHandleWrapper
Register a wrapper factory for a type ID. Called by generated code to register wrapper classes.
registerHandleWrapper(typeId: string, factory: HandleWrapperFactory): void
function tryGetResourceState
Tries to get the current state of a resource
tryGetResourceState(resourceName: string): ResourceEventDto
function unregisterCallback
Unregister a callback by its ID.
unregisterCallback(callbackId: string): boolean
function unregisterCancellation
Unregister a cancellation token by its ID. Call when the operation completes to clean up resources.
unregisterCancellation(cancellationId: string | undefined): void
function waitFor builder
Waits for another resource to be ready
waitFor(dependency: IResource): IResourceWithWaitSupport
function waitForCompletion builder
Waits for resource completion
waitForCompletion(dependency: IResource, exitCode?: number): IResourceWithWaitSupport
function waitForDependencies
Waits for all dependencies of a resource to be ready
waitForDependencies(resource: IResource): void
function waitForResourceHealthy
Waits for a resource to become healthy
waitForResourceHealthy(resourceName: string): ResourceEventDto
function waitForResourceState
Waits for a resource to reach a specified state
waitForResourceState(resourceName: string, targetState?: string): void
function waitForResourceStates
Waits for a resource to reach one of the specified states
waitForResourceStates(resourceName: string, targetStates: string[]): string
function waitForStart builder
Waits for another resource to start
waitForStart(dependency: IResource): IResourceWithWaitSupport
function waitForStartWithBehavior builder
Waits for another resource to start with specific behavior
waitForStartWithBehavior(dependency: IResource, waitBehavior: WaitBehavior): IResourceWithWaitSupport
function waitForWithBehavior builder
Waits for another resource with specific behavior
waitForWithBehavior(dependency: IResource, waitBehavior: WaitBehavior): IResourceWithWaitSupport
function withArgs builder
Adds arguments
withArgs(args: string[]): IResourceWithArgs
function withArgsCallback builder
Sets command-line arguments via callback
withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => void): IResourceWithArgs
function withArgsCallbackAsync builder
Sets command-line arguments via async callback
withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => void): IResourceWithArgs
function withBindMount builder
Adds a bind mount
withBindMount(source: string, target: string, isReadOnly?: boolean): ContainerResource
function withBuildArg builder
Adds a build argument from a parameter resource
withBuildArg(name: string, value: ParameterResource): ContainerResource
function withBuildSecret builder
Adds a build secret from a parameter resource
withBuildSecret(name: string, value: ParameterResource): ContainerResource
function withCertificateTrustScope builder
Sets the certificate trust scope
withCertificateTrustScope(scope: CertificateTrustScope): IResourceWithEnvironment
function withChildRelationship builder
Sets a child relationship
withChildRelationship(child: IResource): IResource
function withCommand builder
Adds a resource command
withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => ExecuteCommandResult, commandOptions?: CommandOptions): IResource
function withConnectionProperty builder
Adds a connection property with a reference expression
withConnectionProperty(name: string, value: ReferenceExpression): IResourceWithConnectionString
function withConnectionPropertyValue builder
Adds a connection property with a string value
withConnectionPropertyValue(name: string, value: string): IResourceWithConnectionString
function withContainerFilesSource builder
Sets the source directory for container files
withContainerFilesSource(sourcePath: string): IResourceWithContainerFiles
function withContainerName builder
Sets the container name
withContainerName(name: string): ContainerResource
function withContainerNetworkAlias builder
Adds a network alias for the container
withContainerNetworkAlias(alias: string): ContainerResource
function withContainerRegistry builder
Configures a resource to use a container registry
withContainerRegistry(registry: IResource): IResource
function withContainerRuntimeArgs builder
Adds runtime arguments for the container
withContainerRuntimeArgs(args: string[]): ContainerResource
function withDescription builder
Sets a parameter description
withDescription(description: string, enableMarkdown?: boolean): ParameterResource
function withDeveloperCertificateTrust builder
Configures developer certificate trust
withDeveloperCertificateTrust(trust: boolean): IResourceWithEnvironment
function withDockerfile builder
Configures the resource to use a Dockerfile
withDockerfile(contextPath: string, dockerfilePath?: string, stage?: string): ContainerResource
function withDockerfileBaseImage builder
Sets the base image for a Dockerfile build
withDockerfileBaseImage(buildImage?: string, runtimeImage?: string): IResource
function withEndpoint builder
Adds a network endpoint
withEndpoint(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): IResourceWithEndpoints
function withEndpointProxySupport builder
Configures endpoint proxy support
withEndpointProxySupport(proxyEnabled: boolean): ContainerResource
function withEntrypoint builder
Sets the container entrypoint
withEntrypoint(entrypoint: string): ContainerResource
function withEnvironment builder
Sets an environment variable
withEnvironment(name: string, value: string): IResourceWithEnvironment
function withEnvironmentCallback builder
Sets environment variables via callback
withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => void): IResourceWithEnvironment
function withEnvironmentCallbackAsync builder
Sets environment variables via async callback
withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => void): IResourceWithEnvironment
function withEnvironmentConnectionString builder
Sets an environment variable from a connection string resource
withEnvironmentConnectionString(envVarName: string, resource: IResourceWithConnectionString): IResourceWithEnvironment
function withEnvironmentEndpoint builder
Sets an environment variable from an endpoint reference
withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): IResourceWithEnvironment
function withEnvironmentExpression builder
Adds an environment variable with a reference expression
withEnvironmentExpression(name: string, value: ReferenceExpression): IResourceWithEnvironment
function withEnvironmentParameter builder
Sets an environment variable from a parameter resource
withEnvironmentParameter(name: string, parameter: ParameterResource): IResourceWithEnvironment
function withExecutableCommand builder
Sets the executable command
withExecutableCommand(command: string): ExecutableResource
function withExplicitStart builder
Prevents resource from starting automatically
withExplicitStart(): IResource
function withExternalHttpEndpoints builder
Makes HTTP endpoints externally accessible
withExternalHttpEndpoints(): IResourceWithEndpoints
function withExternalServiceHttpHealthCheck builder
Adds an HTTP health check to an external service
withExternalServiceHttpHealthCheck(path?: string, statusCode?: number): ExternalServiceResource
function withHealthCheck builder
Adds a health check by key
withHealthCheck(key: string): IResource
function withHttpEndpoint builder
Adds an HTTP endpoint
withHttpEndpoint(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): IResourceWithEndpoints
function withHttpHealthCheck builder
Adds an HTTP health check
withHttpHealthCheck(path?: string, statusCode?: number, endpointName?: string): IResourceWithEndpoints
function withHttpProbe builder
Adds an HTTP health probe to the resource
withHttpProbe(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): IResourceWithEndpoints
function withHttpsDeveloperCertificate builder
Configures HTTPS with a developer certificate
withHttpsDeveloperCertificate(password?: ParameterResource): IResourceWithEnvironment
function withHttpsEndpoint builder
Adds an HTTPS endpoint
withHttpsEndpoint(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): IResourceWithEndpoints
function withIconName builder
Sets the icon for the resource
withIconName(iconName: string, iconVariant?: IconVariant): IResource
function withImage builder
Sets the container image
withImage(image: string, tag?: string): ContainerResource
function withImagePullPolicy builder
Sets the container image pull policy
withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResource
function withImageRegistry builder
Sets the container image registry
withImageRegistry(registry: string): ContainerResource
function withImageSHA256 builder
Sets the image SHA256 digest
withImageSHA256(sha256: string): ContainerResource
function withImageTag builder
Sets the container image tag
withImageTag(tag: string): ContainerResource
function withLifetime builder
Sets the lifetime behavior of the container resource
withLifetime(lifetime: ContainerLifetime): ContainerResource
function withMcpServer builder
Configures an MCP server endpoint on the resource
withMcpServer(path?: string, endpointName?: string): IResourceWithEndpoints
function withOtlpExporter builder
Configures OTLP telemetry export
withOtlpExporter(): IResourceWithEnvironment
function withOtlpExporterProtocol builder
Configures OTLP telemetry export with specific protocol
withOtlpExporterProtocol(protocol: OtlpProtocol): IResourceWithEnvironment
function withoutHttpsCertificate builder
Removes HTTPS certificate configuration
withoutHttpsCertificate(): IResourceWithEnvironment
function withParentRelationship builder
Sets the parent relationship
withParentRelationship(parent: IResource): IResource
function withPipelineConfiguration builder
Configures pipeline step dependencies via a callback
withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => void): IResource
function withPipelineConfigurationAsync builder
Configures pipeline step dependencies via an async callback
withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => void): IResource
function withPipelineStepFactory builder
Adds a pipeline step to the resource
withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => void, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): IResource
function withReference builder
Adds a reference to another resource
withReference(source: IResourceWithConnectionString, connectionName?: string, optional?: boolean): IResourceWithEnvironment
function withReferenceEndpoint builder
Adds a reference to an endpoint
withReferenceEndpoint(endpointReference: EndpointReference): IResourceWithEnvironment
function withReferenceExternalService builder
Adds a reference to an external service
withReferenceExternalService(externalService: ExternalServiceResource): IResourceWithEnvironment
function withReferenceUri builder
Adds a reference to a URI
withReferenceUri(name: string, uri: uri): IResourceWithEnvironment
function withRemoteImageName builder
Sets the remote image name for publishing
withRemoteImageName(remoteImageName: string): IResource
function withRemoteImageTag builder
Sets the remote image tag for publishing
withRemoteImageTag(remoteImageTag: string): IResource
function withReplicas builder
Sets the number of replicas
withReplicas(replicas: number): ProjectResource
function withRequiredCommand builder
Adds a required command dependency
withRequiredCommand(command: string, helpLink?: string): IResource
function withServiceReference builder
Adds a service discovery reference to another resource
withServiceReference(source: IResourceWithServiceDiscovery): IResourceWithEnvironment
function withServiceReferenceNamed builder
Adds a named service discovery reference
withServiceReferenceNamed(source: IResourceWithServiceDiscovery, name: string): IResourceWithEnvironment
function withToolIgnoreExistingFeeds builder
Ignores existing NuGet feeds
withToolIgnoreExistingFeeds(): DotnetToolResource
function withToolIgnoreFailedSources builder
Ignores failed NuGet sources
withToolIgnoreFailedSources(): DotnetToolResource
function withToolPackage builder
Sets the tool package ID
withToolPackage(packageId: string): DotnetToolResource
function withToolPrerelease builder
Allows prerelease tool versions
withToolPrerelease(): DotnetToolResource
function withToolSource builder
Adds a NuGet source for the tool
withToolSource(source: string): DotnetToolResource
function withToolVersion builder
Sets the tool version
withToolVersion(version: string): DotnetToolResource
function withUrl builder
Adds or modifies displayed URLs
withUrl(url: string, displayText?: string): IResource
function withUrlExpression builder
Adds a URL using a reference expression
withUrlExpression(url: ReferenceExpression, displayText?: string): IResource
function withUrlForEndpoint builder
Customizes the URL for a specific endpoint via callback
withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => void): IResource
function withUrlForEndpointFactory builder
Adds a URL for a specific endpoint via factory callback
withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => ResourceUrlAnnotation): IResourceWithEndpoints
function withUrlsCallback builder
Customizes displayed URLs via callback
withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => void): IResource
function withUrlsCallbackAsync builder
Customizes displayed URLs via async callback
withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => void): IResource
function withVolume builder
Adds a volume
withVolume(target: string, name?: string, isReadOnly?: boolean): ContainerResource
function withWorkingDirectory builder
Sets the executable working directory
withWorkingDirectory(workingDirectory: string): ExecutableResource
function wrapIfHandle
Checks if a value is a marshalled handle and wraps it using the wrapper registry.
wrapIfHandle(value: unknown, client?: AspireClient): unknown

Enums