dotnet / dotnet/docs-maui

[maui-labs docs] maui doctor: Document new Xcode compatibility check with auto-fix

Open Beginner friendly
#3,498 0 comments 0 reactions 0 assignees View on GitHub
:watch: Not Triaged
Dominant language
No language data
Stars
282
Forks
265
Avg merge
2d 2h
Merged PRs (30d)
19

Description

## Source PR

**PR**: https://github.com/dotnet/maui-labs/pull/461
**Title**: feat: Add Xcode compatibility check with auto-fix to maui doctor
**Author**: jfversluis
**Merged**: 2026-09-02

## Summary of Changes

PR #461 adds a new **Xcode compatibility check** to `maui doctor` on macOS/Apple platforms. When the selected Xcode version is incompatible with the .NET Apple SDK packs installed (e.g., `Microsoft.iOS.Sdk`, `Microsoft.MacCatalyst.Sdk`), `maui doctor` now:

1. Reports a **Warning** with an explanation of which Xcode version is required.
2. Offers an **automatic fix** (`sudo xcode-select --switch "(path)"`) when a compatible Xcode version is already installed on the machine — `maui doctor --fix` will run this command automatically.
3. Provides **manual fix steps** (install the required Xcode) when no compatible version is found locally.
4. Handles the edge case where installed SDK packs require **conflicting Xcode versions** (e.g., iOS SDK requires 26.5, macCatalyst SDK requires 26.4) — in this case the check reports a warning without an auto-fix.
5. Reports **no Xcode is selected** (via `xcode-select`) as a separate warning with an auto-fix.

A new error code **E2224** (`AppleXcodeVersionMismatch`) is associated with this check.

## Documentation Pages Affected

- **`docs/developer-tools/cli/doctor.md`** (or wherever `maui doctor` checks are listed) — add the new Xcode compatibility check.
- **`docs/developer-tools/cli/index.md`** or the `maui doctor` reference page — update the list of checks performed on Apple platforms.
- **Error code reference** (if one exists, e.g., `docs/developer-tools/cli/error-codes.md`) — add E2224.

## Suggested Changes

### 1. In the `maui doctor` checks reference table (Apple platform section)

Add a new row for the Xcode compatibility check:

| Check | Description | Error Code |
|-------|-------------|------------|
| Xcode compatibility | Verifies that the selected Xcode version matches the version required by the installed .NET Apple SDK packs (`Microsoft.iOS.Sdk`, `Microsoft.MacCatalyst.Sdk`, etc.). | E2224 |

### 2. Describe the auto-fix behavior

Under the `maui doctor --fix` section (or wherever auto-fix is documented), add:

> **Xcode version mismatch (E2224)**
>
> If `maui doctor` detects that the selected Xcode version is incompatible with your installed .NET Apple SDK packs, it checks whether a compatible Xcode version is already installed. If found, running `maui doctor --fix` automatically runs:
>
> ```bash
> sudo xcode-select --switch "/Applications/Xcode (version).app"
> ```
>
> If no compatible Xcode is installed, the check reports manual steps:
> - Download and install the required Xcode version from the Apple Developer portal.
> - Select it with: `sudo xcode-select --switch "/Applications/Xcode-(version).app"`
>
> If your installed SDK packs require **conflicting Xcode versions** (for example, the iOS SDK requires Xcode 26.5 but the macCatalyst SDK requires Xcode 26.4), the auto-fix is not available and you must manually decide which target platform to prioritize.

### 3. No Xcode selected warning

Add documentation for the case where no Xcode is selected at all:

> If `xcode-select` reports no Xcode is currently selected, `maui doctor` reports a warning. If only one compatible Xcode is installed, `maui doctor --fix` automatically selects it.

### 4. Error code reference

If a table of error codes exists, add:

| E2224 | AppleXcodeVersionMismatch | The currently selected Xcode version is not compatible with the installed .NET Apple SDK packs. |

> Generated by [PR Documentation Check](https://github.com/dotnet/maui-labs/actions/runs/33617765423) for issue #461 · [◷](https://github.com/search?q=repo%3Adotnet%2Fdocs-maui+is%3Aissue+%22gh-aw-workflow-call-id%3A+dotnet%2Fmaui-labs%2Fpr-docs-check%22&type=issues)

Contributor guide

Open the contributing guide

Research direction

Start with docs/developer-tools/cli/doctor.md and inspect docs/developer-tools/cli/index.md and any existing error-code reference. Document the Apple Xcode compatibility check, E2224, auto-fix and manual-fix paths, conflicting SDK requirements, and the no-Xcode-selected warning. Done means the affected maui doctor check lists and error-code documentation describe all behaviors from PR #461.

Written by the indexing model from the issue text.

Assessment

Domain
cli, documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
Half a day
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.