Aspirerelease/17.0
Watch Aspire live streamsDocsTry Aspire

ProjectResource

Handle
📦 Aspire.Hosting v17.0.0

A resource that represents a specified .NET project.

type ProjectResource interface {
DotnetProgramResource
IComputeResource
IContainerFilesDestinationResource
Resource
ResourceWithArgs
ResourceWithEndpoints
ResourceWithEnvironment
ResourceWithWaitSupport
}

Methods

Configures the project to disable forwarded headers when being published.
DisableForwardedHeaders() ProjectResource
ProjectResource

The resource builder.

Returns a handle; failures surface later via Err().

methodPublishAsDockerFilebuilder
Publishes a project as a Docker file with optional container configuration
PublishAsDockerFile(options ...*PublishAsDockerFileOptions) ProjectResource
options...*PublishAsDockerFileOptionsOptional settings, described under Options.

Optional parameters are passed in a trailing options ...*PublishAsDockerFileOptions argument.

Configurefunc(obj ContainerResource)callbackOptional action to configure the container resource
ProjectResource

The resource builder.

Returns a handle; failures surface later via Err().

Includes only the specified project endpoint names in environment-variable injection.
WithEndpointsInEnvironment(endpointNames []string) ProjectResource
endpointNames[]stringThe endpoint names to include in environment variables.
ProjectResource

The same project resource builder handle for chaining.

Returns a handle; failures surface later via Err().

methodWithReplicasbuilder
Configures how many replicas of the project should be created for the project.
WithReplicas(replicas float64) ProjectResource
replicasfloat64The number of replicas.
ProjectResource

The resource builder.

Returns a handle; failures surface later via Err().

methodWithVolumebuilder
Adds a volume to a project resource.
WithVolume(
target string,
name string,
env string,
options ...*ProjectResourceWithVolumeOptions,
) ProjectResource
targetstringThe mount path inside the published container.
namestringThe volume name.
envstringThe environment variable that receives the effective volume path.
options...*ProjectResourceWithVolumeOptionsOptional settings, described under Options.

Optional parameters are passed in a trailing options ...*ProjectResourceWithVolumeOptions argument.

IsReadOnly*boolWhether the published volume is read-only.
ProjectResource

The same project resource builder handle for chaining.

Returns a handle; failures surface later via Err().