Skip to content

[spec] Add maui device list command spec to CLI design doc#34277

Open
rmarinho wants to merge 1 commit intomainfrom
docs/maui-device-list
Open

[spec] Add maui device list command spec to CLI design doc#34277
rmarinho wants to merge 1 commit intomainfrom
docs/maui-device-list

Conversation

@rmarinho
Copy link
Member

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Summary

Adds the maui device list command specification to the existing CLI design document (docs/design/cli.md). This command provides unified, cross-platform device enumeration without requiring a project context.

See PR #33865 for the full DevTools spec.

What is added

Command: maui device list [--platform <p>] [--json]

Lists connected devices, running emulators, and available simulators across all platforms in a single call.

Two approaches analysis

The spec analyzes two discovery approaches and recommends the project-free one:

MSBuild (dotnet run --list-devices) Native CLI (maui device list)
Project required Yes No
Cross-platform One TFM at a time All platforms at once
Speed Slower (MSBuild eval) Fast (<2s)
ID compatibility Source of truth Same native IDs

Scenarios requiring project-free discovery

  1. AI agent bootstrapping (no .csproj yet)
  2. IDE startup (device picker before project loads)
  3. Environment validation ("can I see my phone?")
  4. CI pipeline setup (check emulator before build)
  5. Multi-project solutions (unified view)
  6. Cross-platform overview (all devices at once)

Recommended approach

maui device list uses direct native tool invocation (adb devices, simctl list, devicectl list). Device IDs are compatible with dotnet run --device, making them complementary:

maui device list          →  "What devices exist on this machine?"
dotnet run --list-devices →  "What devices can run this project?"

Other changes

  • Added references to ComputeAvailableDevices MSBuild targets in dotnet/android and dotnet/macios
  • Updated AI agent workflow example to include device discovery step
  • Fixed AppleDev.Tools reference (xcdevice → devicectl)

Copilot AI review requested due to automatic review settings February 27, 2026 10:49
@github-actions
Copy link
Contributor

github-actions bot commented Feb 27, 2026

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 34277

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 34277"

This comment was marked as outdated.

@rmarinho rmarinho changed the title docs: Add maui device list command spec to CLI design doc [spec] Add maui device list command spec to CLI design doc Feb 27, 2026
@rmarinho rmarinho force-pushed the docs/maui-device-list branch from 94cab3a to 805c3bc Compare February 27, 2026 13:33
Add 'maui device list' command specification to the CLI design doc,
including:

- Command syntax with --platform and --json options
- Human-readable and JSON output schemas
- Analysis of two discovery approaches (MSBuild vs native CLI)
- Comparison table of pros/cons
- Six real-world scenarios requiring project-free device enumeration
- Recommended approach (direct native tool invocation)
- Relationship to dotnet run --list-devices (complementary)
- References to ComputeAvailableDevices targets in dotnet/android
  and dotnet/macios

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

- [simctl command-line tool](https://nshipster.com/simctl/)

[vibe-wpf]: https://github.com/jonathanpeppers/vibe-wpf
[appledev-tools]: https://github.com/Redth/AppleDev.Tools
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Xamarin.MacDev?

| | Approach A (MSBuild) | Approach B (Native CLI) |
|---|---|---|
| **Project required** | Yes — needs `.csproj` | No |
| **Cross-platform** | One platform per call (per TFM) | All platforms in one call |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would you need to list all the platforms in one call? This will be really slow.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vscode does that

Comment on lines +306 to +309
1. **AI agent bootstrapping** — An agent starting a "vibe coding"
session needs to discover available targets before scaffolding a
project. It cannot call `dotnet run --list-devices` because there
is no `.csproj` yet.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand, why does it need to know the devices before a project exists?

What is it going to do with the list of devices?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • you can see this AI usage, AI wants to see if device exists before creating it for example, or know figure what it can launch.
  • You can see this on CI, check if the device exists before creating one

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you share a screenshot/example?

| **Project required** | Yes — needs `.csproj` | No |
| **Cross-platform** | One platform per call (per TFM) | All platforms in one call |
| **Metadata** | Rich (RuntimeIdentifier, workload-specific fields) | Standard (id, description, type, status) |
| **Speed** | Slower (MSBuild evaluation + restore) | Fast (<2s, direct process calls) |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I doubt listing devices for all platforms will beat 2 seconds, do we have a measurement?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a working version now on vscode it s what it looks like :) I can try give you a exact number

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants