# RustAppResource.WithCargoPackage

- Module: [Aspire.Hosting.Rust](/reference/api/go/aspire.hosting.rust.md)
- Defined on: [RustAppResource](/reference/api/go/aspire.hosting.rust/rustappresource.md)
- Version: `17.0.0-preview.1.26567.5`
- Kind: `method`

Configures the workspace package to build and run.

## Remarks

Passed to cargo as `--package`. Required when the crate directory is a workspace whose default
members include more than one package with a binary target, because the binary to run would otherwise
be ambiguous. Library-only members are ignored, so an app crate beside library crates needs nothing.

## Definition

```go
type RustAppResource interface {
    // ... omitted for brevity
    WithCargoPackage(packageName string) RustAppResource
}
```

## Signature

```go
WithCargoPackage(packageName string) RustAppResource
```

## Parameters

- `packageName` (`string`) -- The cargo package name.

## Returns

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

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

## Defined on

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