# IResourceWithEnvironment.withReferenceEnvironment

- Module: [Aspire.Hosting](/reference/api/typescript/aspire.hosting.md)
- Defined on: [IResourceWithEnvironment](/reference/api/typescript/aspire.hosting/iresourcewithenvironment.md)
- Version: `13.4.0`
- Kind: `method`

Configures how information is injected into environment variables when the resource references other resources.

## Definition

```typescript
interface IResourceWithEnvironment {
  // ... omitted for brevity
  withReferenceEnvironment(options: ReferenceEnvironmentInjectionOptions): IResourceWithEnvironment;
}
```

## Signature

```typescript
withReferenceEnvironment(options: ReferenceEnvironmentInjectionOptions): IResourceWithEnvironment
```

## Parameters

- `options` ([ReferenceEnvironmentInjectionOptions](/reference/api/typescript/aspire.hosting/referenceenvironmentinjectionoptions.md))

## Returns

[IResourceWithEnvironment](/reference/api/typescript/aspire.hosting/iresourcewithenvironment.md) `builder`

## Defined on

- [IResourceWithEnvironment](/reference/api/typescript/aspire.hosting/iresourcewithenvironment.md) -- `interface`
