Aspirerelease/17.0
Watch Aspire live streamsDocsTry Aspire

WithTrait

Method
📦 Aspire.Hosting v17.0.0
func (Resource) WithTrait(
name string,
value string,
) Resource

Signature

methodWithTraitbuilder
Adds immutable, non-sensitive metadata to a resource. Repeated names add multiple values.
WithTrait(
name string,
value string,
) Resource
namestringThe case-sensitive trait name.
valuestringThe trait value. Do not include secrets.
Resource

The resource builder.

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

Applies to

This method applies to the following types: