# ProjectResource.WithVolume

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

Adds a volume to a project resource.

## Definition

```go
type ProjectResource interface {
    // ... omitted for brevity
    WithVolume(
        target string,
        name string,
        env string,
        options ...*ProjectResourceWithVolumeOptions,
    ) ProjectResource
}
```

## Signature

```go
WithVolume(
    target string,
    name string,
    env string,
    options ...*ProjectResourceWithVolumeOptions,
) ProjectResource
```

## Parameters

- `target` (`string`) -- The mount path inside the published container.
- `name` (`string`) -- The volume name.
- `env` (`string`) -- The environment variable that receives the effective volume path.
- `options` (`...*ProjectResourceWithVolumeOptions`) -- optional settings, see [Options](#options)

## Options

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

- `IsReadOnly` (`*bool`) -- Whether the published volume is read-only.

## Returns

[`ProjectResource`](/reference/api/go/aspire.hosting/projectresource.md) -- The same project resource builder handle for chaining.

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

## Defined on

- [ProjectResource](/reference/api/go/aspire.hosting/projectresource.md) -- `handle`
