# WithCargoProfile

- Module: [Aspire.Hosting.Rust](/reference/api/go/aspire.hosting.rust.md)
- Version: `17.0.0-preview.1.26565.2`
- Kind: `method`
- Defined on: [`RustAppResource`](/reference/api/go/aspire.hosting.rust/rustappresource.md)
- Source: [GitHub](https://github.com/microsoft/aspire/tree/bcfa151cdca6d0a573f22d5d9c23f9c727cb3b2f)

Configures the named cargo profile to build with.

## Remarks

Passed to cargo as `--profile`, which takes precedence over `WithCargoReleaseBuild` because
cargo rejects `--profile` and `--release` together.

## Definition

```go
func (RustAppResource) WithCargoProfile(profileName string) RustAppResource
```

## Parameters

- `profileName` (`string`) -- The profile name, for example `dev`, `release`, or a custom profile.

## Returns

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

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

## Applies to

- [`RustAppResource`](/reference/api/go/aspire.hosting.rust/rustappresource.md)
