# WithEndpointsInEnvironment

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

Includes only the specified project endpoint names in environment-variable injection.

## Definition

```go
func (ProjectResource) WithEndpointsInEnvironment(endpointNames []string) ProjectResource
```

## Parameters

- `endpointNames` (`[]string`) -- The endpoint names to include in environment variables.

## 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()`.

## Applies to

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