# MauiMacCatalystExtensions Methods

- Package: [Aspire.Hosting.Maui](/reference/api/csharp/aspire.hosting.maui.md)
- Type: [MauiMacCatalystExtensions](/reference/api/csharp/aspire.hosting.maui/mauimaccatalystextensions.md)
- Kind: `Methods`
- Members: `2`

Provides extension methods for adding Mac Catalyst platform resources to MAUI projects.

## AddMacCatalystDevice(IResourceBuilder<MauiProjectResource>)

- Name: `AddMacCatalystDevice(IResourceBuilder<MauiProjectResource>)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<MauiMacCatalystPlatformResource>`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/becb48e2d61099e35ae336d527d3875e928d6594/src/Aspire.Hosting.Maui/MauiMacCatalystExtensions.cs#L45-L48)

Adds a Mac Catalyst device resource to run the MAUI application on the macOS platform.

```csharp
public static class MauiMacCatalystExtensions
{
    public static IResourceBuilder<MauiMacCatalystPlatformResource> AddMacCatalystDevice(
        this IResourceBuilder<MauiProjectResource> builder)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IResourceBuilder<MauiProjectResource>`)
  The MAUI project resource builder.

## Returns

`IResourceBuilder<MauiMacCatalystPlatformResource>` -- A reference to the `ApplicationModel.IResourceBuilder`1`.

## Remarks

This method creates a new Mac Catalyst platform resource that will run the MAUI application targeting the Mac Catalyst platform using `dotnet run`. The resource does not auto-start and must be explicitly started from the dashboard by clicking the start button.

The resource name will default to "{projectName}-maccatalyst".

This overload is not available in polyglot app hosts. Use [MauiMacCatalystExtensions.AddMacCatalystDevice(IResourceBuilder<MauiProjectResource>)](/reference/api/csharp/aspire.hosting.maui/mauimaccatalystextensions/methods.md#addmaccatalystdevice-iresourcebuilder-mauiprojectresource) instead.

## Examples

Add a Mac Catalyst device to a MAUI project:

```csharp
var builder = DistributedApplication.CreateBuilder(args);

var maui = builder.AddMauiProject("mauiapp", "../MyMauiApp/MyMauiApp.csproj");
var macCatalystDevice = maui.AddMacCatalystDevice();

builder.Build().Run();
```

## ATS metadata

### Ignored by ATS

- Excluded from automatic Polyglot export.

## AddMacCatalystDevice(IResourceBuilder<MauiProjectResource>, string)

- Name: `AddMacCatalystDevice(IResourceBuilder<MauiProjectResource>, string)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<MauiMacCatalystPlatformResource>`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/becb48e2d61099e35ae336d527d3875e928d6594/src/Aspire.Hosting.Maui/MauiMacCatalystExtensions.cs#L83-L110)

Adds a Mac Catalyst device resource to run the MAUI application on the macOS platform with a specific name.

```csharp
public static class MauiMacCatalystExtensions
{
    public static IResourceBuilder<MauiMacCatalystPlatformResource> AddMacCatalystDevice(
        this IResourceBuilder<MauiProjectResource> builder,
        string name)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IResourceBuilder<MauiProjectResource>`)
  The MAUI project resource builder.
- `name` (`string`)
  The name of the Mac Catalyst device resource.

## Returns

`IResourceBuilder<MauiMacCatalystPlatformResource>` -- A reference to the `ApplicationModel.IResourceBuilder`1`.

## Remarks

This method creates a new Mac Catalyst platform resource that will run the MAUI application targeting the Mac Catalyst platform using `dotnet run`. The resource does not auto-start and must be explicitly started from the dashboard by clicking the start button.

You can add multiple Mac Catalyst device resources to a MAUI project by calling this method multiple times with different names.

## Examples

Add multiple Mac Catalyst devices to a MAUI project:

```csharp
var builder = DistributedApplication.CreateBuilder(args);

var maui = builder.AddMauiProject("mauiapp", "../MyMauiApp/MyMauiApp.csproj");
var macCatalystDevice1 = maui.AddMacCatalystDevice("maccatalyst-device-1");
var macCatalystDevice2 = maui.AddMacCatalystDevice("maccatalyst-device-2");

builder.Build().Run();
```

## ATS metadata

### ATS export

- Available to Polyglot AppHosts through the Aspire Type System.
