Edit

Build targets for iOS, Mac Catalyst, macOS and tvOS

The following build targets are defined in .NET for iOS, Mac Catalyst, macOS, and tvOS projects.

Build (Default)

Builds the source code within a project and all dependencies.

Clean

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:

$ dotnet build -t:ComputeAvailableDevices

This target is part of the .NET SDK device selection specification and enables commands like:

$ dotnet run --device UDID

Added in .NET 11.

GetApplicationArtifacts

Builds the project and returns the @(ApplicationArtifact) item group. This target always runs Build first so platform .app, .ipa, .pkg, and .xcarchive artifacts are produced and collected before any custom metadata extension targets run. The Publish target returns the same item group for artifacts it creates.

The returned item group reflects the artifacts the current invocation is configured to build; it does not scan for .ipa, .pkg, or .xcarchive files left on disk by a previous build. The .app bundle is always collected for an application project (excluding app extension and watch app projects), while the .ipa, .pkg, and .xcarchive outputs are only collected when BuildIpa, CreatePackage, or ArchiveOnBuild (respectively) is enabled in the same invocation. The Publish target enables BuildIpa (mobile) or CreatePackage (desktop) by default.

$ dotnet build MyApp.csproj -t:GetApplicationArtifacts -getItem:ApplicationArtifact
$ dotnet build MyApp.csproj -t:Publish -getItem:ApplicationArtifact

See ApplicationArtifact for supported metadata.

Targets that need to add or update @(ApplicationArtifact) metadata before GetApplicationArtifacts or Publish returns can append to GetApplicationArtifactsDependsOn.

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 $(Device) property.

dotnet build -t:Run project.csproj -p:Device=<udid>