MauiiOSExtensions.AddiOSDevice Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| AddiOSDevice(IResourceBuilder<MauiProjectResource>) |
Adds an iOS physical device resource to run the MAUI application on an iOS device. |
| AddiOSDevice(IResourceBuilder<MauiProjectResource>, String) |
Adds an iOS physical device resource to run the MAUI application on an iOS device with a specific name. |
| AddiOSDevice(IResourceBuilder<MauiProjectResource>, String, String) |
Adds an iOS physical device resource to run the MAUI application on an iOS device with a specific name and device UDID. |
AddiOSDevice(IResourceBuilder<MauiProjectResource>)
- Source:
- MauiiOSExtensions.cs
Adds an iOS physical device resource to run the MAUI application on an iOS device.
public static Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.Maui.MauiiOSDeviceResource> AddiOSDevice(this Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.Maui.MauiProjectResource> builder);
static member AddiOSDevice : Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.Maui.MauiProjectResource> -> Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.Maui.MauiiOSDeviceResource>
<Extension()>
Public Function AddiOSDevice (builder As IResourceBuilder(Of MauiProjectResource)) As IResourceBuilder(Of MauiiOSDeviceResource)
Parameters
- builder
- IResourceBuilder<MauiProjectResource>
The MAUI project resource builder.
Returns
A reference to the IResourceBuilder<T>.
Examples
Add an iOS device to a MAUI project:
var builder = DistributedApplication.CreateBuilder(args);
var maui = builder.AddMauiProject("mauiapp", "../MyMauiApp/MyMauiApp.csproj");
var iOSDevice = maui.AddiOSDevice();
builder.Build().Run();
Remarks
This method creates a new iOS device platform resource that will run the MAUI application targeting the iOS 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}-ios-device".
This will run the application on a physical iOS device connected via USB. The device must be provisioned before deployment. For more information, see https://learn.microsoft.com/dotnet/maui/ios/device-provisioning
If only one device is attached, it will automatically use that device. If multiple devices are connected, use the overload with deviceId parameter to specify which device to use by UDID. You can find the device UDID in Xcode under Window > Devices and Simulators > Devices tab.
Applies to
AddiOSDevice(IResourceBuilder<MauiProjectResource>, String)
- Source:
- MauiiOSExtensions.cs
Adds an iOS physical device resource to run the MAUI application on an iOS device with a specific name.
public static Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.Maui.MauiiOSDeviceResource> AddiOSDevice(this Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.Maui.MauiProjectResource> builder, string name);
static member AddiOSDevice : Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.Maui.MauiProjectResource> * string -> Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.Maui.MauiiOSDeviceResource>
<Extension()>
Public Function AddiOSDevice (builder As IResourceBuilder(Of MauiProjectResource), name As String) As IResourceBuilder(Of MauiiOSDeviceResource)
Parameters
- builder
- IResourceBuilder<MauiProjectResource>
The MAUI project resource builder.
- name
- String
The name of the iOS device resource.
Returns
A reference to the IResourceBuilder<T>.
Examples
Add multiple iOS devices to a MAUI project:
var builder = DistributedApplication.CreateBuilder(args);
var maui = builder.AddMauiProject("mauiapp", "../MyMauiApp/MyMauiApp.csproj");
var device1 = maui.AddiOSDevice("ios-device-1");
var device2 = maui.AddiOSDevice("ios-device-2");
builder.Build().Run();
Remarks
This method creates a new iOS device platform resource that will run the MAUI application targeting the iOS platform using dotnet run. The resource does not auto-start and must be explicitly started from the dashboard by clicking the start button.
Multiple iOS device resources can be added to the same MAUI project if needed, each with a unique name.
This will run the application on a physical iOS device connected via USB. The device must be provisioned before deployment. For more information, see https://learn.microsoft.com/dotnet/maui/ios/device-provisioning
If only one device is attached, it will automatically use that device. If multiple devices are connected, use the overload with deviceId parameter to specify which device to use by UDID. You can find the device UDID in Xcode under Window > Devices and Simulators > Devices tab.
Applies to
AddiOSDevice(IResourceBuilder<MauiProjectResource>, String, String)
- Source:
- MauiiOSExtensions.cs
Adds an iOS physical device resource to run the MAUI application on an iOS device with a specific name and device UDID.
public static Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.Maui.MauiiOSDeviceResource> AddiOSDevice(this Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.Maui.MauiProjectResource> builder, string name, string? deviceId = default);
static member AddiOSDevice : Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.Maui.MauiProjectResource> * string * string -> Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.Maui.MauiiOSDeviceResource>
<Extension()>
Public Function AddiOSDevice (builder As IResourceBuilder(Of MauiProjectResource), name As String, Optional deviceId As String = Nothing) As IResourceBuilder(Of MauiiOSDeviceResource)
Parameters
- builder
- IResourceBuilder<MauiProjectResource>
The MAUI project resource builder.
- name
- String
The name of the iOS device resource.
- deviceId
- String
Optional device UDID to target a specific iOS device. If not specified, uses the only attached device (requires exactly one device to be connected).
Returns
A reference to the IResourceBuilder<T>.
Examples
Add multiple iOS devices to a MAUI project:
var builder = DistributedApplication.CreateBuilder(args);
var maui = builder.AddMauiProject("mauiapp", "../MyMauiApp/MyMauiApp.csproj");
// Default device (only one attached)
var device1 = maui.AddiOSDevice("ios-device-default");
// Specific device by UDID
var device2 = maui.AddiOSDevice("ios-device-iphone13", "00008030-001234567890123A");
builder.Build().Run();
Remarks
This method creates a new iOS device platform resource that will run the MAUI application targeting the iOS platform using dotnet run. The resource does not auto-start and must be explicitly started from the dashboard by clicking the start button.
Multiple iOS device resources can be added to the same MAUI project if needed, each with a unique name.
This will run the application on a physical iOS device connected via USB. The device must be provisioned before deployment. For more information, see https://learn.microsoft.com/dotnet/maui/ios/device-provisioning
To target a specific device when multiple are connected, provide the device UDID. You can find the device UDID in Xcode under Window > Devices and Simulators > Devices tab, or right-click on the device and select "Copy Identifier".