# ProjectResourceExtensions Methods

- Package: [Aspire.Hosting](/reference/api/csharp/aspire.hosting.md)
- Type: [ProjectResourceExtensions](/reference/api/csharp/aspire.hosting/projectresourceextensions.md)
- Kind: `Methods`
- Members: `2`

Provides extension methods for [DistributedApplicationModel](/reference/api/csharp/aspire.hosting/distributedapplicationmodel.md) to work with [ProjectResource](/reference/api/csharp/aspire.hosting/projectresource.md) instances.

## GetProjectMetadata(ProjectResource)

- Name: `GetProjectMetadata(ProjectResource)`
- Modifiers: `extension`
- Returns: [IProjectMetadata](/reference/api/csharp/aspire.hosting/iprojectmetadata.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/ApplicationModel/ProjectResourceExtensions.cs#L33-L35)

Gets the project metadata for the specified project resource.

```csharp
public static class ProjectResourceExtensions
{
    public static IProjectMetadata GetProjectMetadata(
        this ProjectResource projectResource)
    {
        // ...
    }
}
```

## Parameters

- `projectResource` ([ProjectResource](/reference/api/csharp/aspire.hosting/projectresource.md))
  The project resource.

## Returns

[IProjectMetadata](/reference/api/csharp/aspire.hosting/iprojectmetadata.md) -- The project metadata.

## Exceptions

- `InvalidOperationException` -- Thrown when the project resource doesn't have project metadata.

## ATS metadata

### Ignored by ATS

- Reason: Project metadata is a .NET-specific contract and is not part of the ATS surface.

## GetProjectResources(DistributedApplicationModel)

- Name: `GetProjectResources(DistributedApplicationModel)`
- Modifiers: `extension`
- Returns: [IEnumerable<ProjectResource>](/reference/api/csharp/aspire.hosting/projectresource.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/ApplicationModel/ProjectResourceExtensions.cs#L19-L21)

Returns all project resources in the distributed application model.

```csharp
public static class ProjectResourceExtensions
{
    public static IEnumerable<ProjectResource> GetProjectResources(
        this DistributedApplicationModel model)
    {
        // ...
    }
}
```

## Parameters

- `model` ([DistributedApplicationModel](/reference/api/csharp/aspire.hosting/distributedapplicationmodel.md))
  The distributed application model.

## Returns

[IEnumerable<ProjectResource>](/reference/api/csharp/aspire.hosting/projectresource.md) -- An enumerable collection of project resources.

## ATS metadata

### Ignored by ATS

- Reason: Application model inspection helper -- not part of the ATS surface.
