# DotnetProjectResource

- Module: [Aspire.Hosting.Dotnet](/reference/api/typescript/aspire.hosting.dotnet.md)
- Version: `17.0.0`
- Kind: `handle`
- Source: [GitHub](https://github.com/microsoft/aspire/tree/2d325b13709752ba6d9a943635c5e2940a2530c0)

A resource that represents an SDK-style .NET project or file-based C# app added by path.

## Definition

```typescript
interface DotnetProjectResource
  extends IComputeResource,
    IContainerFilesDestinationResource,
    IDotnetProgramResource,
    IResource,
    IResourceWithArgs,
    IResourceWithEndpoints,
    IResourceWithEnvironment,
    IResourceWithProbes,
    IResourceWithWaitSupport,
    IResourceWithServiceDiscovery {
  disableForwardedHeaders(): DotnetProjectResource;
  withBuildEnvironment(
      name: string,
      value: string): DotnetProjectResource;
  withEndpointsInEnvironment(endpointNames: string[]): DotnetProjectResource;
  withReplicas(replicas: number): DotnetProjectResource;
}
```

## Methods

- [disableForwardedHeaders](/reference/api/typescript/aspire.hosting.dotnet/dotnetprojectresource/disableforwardedheaders.md) -- `method` -- Disables automatic forwarded-header configuration when publishing the .NET project.
    ```typescript
  disableForwardedHeaders(): DotnetProjectResource
  ```
- [withBuildEnvironment](/reference/api/typescript/aspire.hosting.dotnet/dotnetprojectresource/withbuildenvironment.md) -- `method` -- Adds an environment variable to the build process for a .NET project.
    ```typescript
  withBuildEnvironment(name: string, value: string): DotnetProjectResource
  ```
- [withEndpointsInEnvironment](/reference/api/typescript/aspire.hosting.dotnet/dotnetprojectresource/withendpointsinenvironment.md) -- `method` -- Configures endpoint environment-variable injection for a .NET project in polyglot AppHosts.
    ```typescript
  withEndpointsInEnvironment(endpointNames: string[]): DotnetProjectResource
  ```
- [withReplicas](/reference/api/typescript/aspire.hosting.dotnet/dotnetprojectresource/withreplicas.md) -- `method` -- Configures the number of replicas of the .NET project.
    ```typescript
  withReplicas(replicas: number): DotnetProjectResource
  ```
