diff --git a/docs/ios/building-apps/build-properties.md b/docs/ios/building-apps/build-properties.md index 08f9a27..b456f6a 100644 --- a/docs/ios/building-apps/build-properties.md +++ b/docs/ios/building-apps/build-properties.md @@ -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 ` 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. diff --git a/docs/ios/building-apps/build-targets.md b/docs/ios/building-apps/build-targets.md index fb548e6..fbf0abf 100644 --- a/docs/ios/building-apps/build-targets.md +++ b/docs/ios/building-apps/build-targets.md @@ -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= ```