Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions docs/ios/building-apps/build-properties.md
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,18 @@ Only applicable to macOS and Mac Catalyst projects.

See [BuildIpa](#buildipa) for iOS and tvOS projects.

## Device

Specifies which mobile device or simulator to target when using `dotnet run --device <Device>` or MSBuild targets that interact with devices (such as `Run`, `Install`, or `Uninstall`).

The value can be anything the command-line tools `simctl` or `devicectl`
accept for the device name; this is typically either the UDID or the name of
the device. For example, for the device `My iOS Device` with UDID `0000-aaaabbbb`, use
either `-p:Device="My iOS Device"` or `-p:Device=0000-aaaabbbb`.

For more information about device selection, see the
[.NET SDK device selection specification](https://github.com/dotnet/sdk/blob/2b9fc02a265c735f2132e4e3626e94962e48bdf5/documentation/specs/dotnet-run-for-maui.md).

## DeviceSpecificBuild

If the build should be specific to the selected device.
Expand Down
32 changes: 30 additions & 2 deletions docs/ios/building-apps/build-targets.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,39 @@ Builds the source code within a project and all dependencies.

Removes all files generated by the build process.

## ComputeAvailableDevices

Queries and returns a list of available iOS or tvOS devices and simulators that can be used with `dotnet run`.

This target is called automatically by the .NET SDK's `dotnet run` command to
support device selection via the `--device` option. It returns a `@(Devices)`
item group where each device has the following metadata:

- **Description**: The name of the device (e.g., "iPhone 16 - iOS 26.0" for simulators, "My iPhone 16" for physical devices)
- **Type**: Either "Device" or "Simulator"
- **OSVersion**: The OS version of the device
- **UDID**: The UDID of the device
- **RuntimeIdentifier**: The RuntimeIdentifier of the device

For example, to list all available devices:

```shell
$ dotnet build -t:ComputeAvailableDevices
```

This target is part of the [.NET SDK device selection specification](https://github.com/dotnet/sdk/blob/2b9fc02a265c735f2132e4e3626e94962e48bdf5/documentation/specs/dotnet-run-for-maui.md) and enables commands like:

```shell
$ dotnet run --device UDID
```

Added in .NET 11.

## Run

Builds the source code within a project and all dependencies, and then deploys and runs it
on a default simulator/device. A specific deployment target can be set by using the `$(_DeviceName)` property.
on a default simulator/device. A specific deployment target can be set by using the `$(Device)` property.

```dotnetcli
dotnet build -t:Run project.csproj -p:_DeviceName=$(MY_DEVICE_UDID)
dotnet build -t:Run project.csproj -p:Device=<udid>
```
Loading