# Resource.WithHiddenOnCompletion

- Module: [Aspire.Hosting](/reference/api/go/aspire.hosting.md)
- Defined on: [Resource](/reference/api/go/aspire.hosting/resource.md)
- Version: `17.0.0`
- Kind: `method`

Hides the resource from default resource lists after successful completion

## Remarks

This method is useful for one-off resources such as setup scripts, migrations, or build steps that should remain visible while running
and then be hidden after successful completion.
Hidden resources can still be accessed directly by their name, by using `Show hidden resources` toggle in the dashboard or by using `aspire describe --include-hidden` from the CLI.

## Definition

```go
func (Resource) WithHiddenOnCompletion(options ...*WithHiddenOnCompletionOptions) Resource
```

## Signature

```go
WithHiddenOnCompletion(options ...*WithHiddenOnCompletionOptions) Resource
```

## Parameters

- `options` (`...*WithHiddenOnCompletionOptions`) -- optional settings, see [Options](#options)

## Options

Optional parameters are passed in a trailing `options ...*WithHiddenOnCompletionOptions` argument.

- `ExitCode` (`*float64`) -- The completion exit code to treat as successful. Defaults to `0`.
- `ExitCodes` (`[]float64`) -- Completion exit codes to treat as successful. If no values are provided, `0` is used.

## Returns

[`Resource`](/reference/api/go/aspire.hosting/resource.md) -- The resource builder.

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

## Defined on

A marker interface declares no methods of its own in Go. Its functions are declared on the concrete types they apply to.

- [Resource](/reference/api/go/aspire.hosting/resource.md) -- `marker`

## Applies to

- [`CSharpAppResource`](/reference/api/go/aspire.hosting/csharpappresource.md)
- [`ContainerRegistryResource`](/reference/api/go/aspire.hosting/containerregistryresource.md)
- [`ContainerResource`](/reference/api/go/aspire.hosting/containerresource.md)
- [`DotnetToolResource`](/reference/api/go/aspire.hosting/dotnettoolresource.md)
- [`ExecutableResource`](/reference/api/go/aspire.hosting/executableresource.md)
- [`ExternalServiceResource`](/reference/api/go/aspire.hosting/externalserviceresource.md)
- [`ParameterResource`](/reference/api/go/aspire.hosting/parameterresource.md)
- [`ProjectResource`](/reference/api/go/aspire.hosting/projectresource.md)
