$npx -y skills add managedcode/dotnet-skills --skill dotnet-maui-doctorDiagnoses and fixes .NET MAUI development environment issues. Validates .NET SDK, workloads, Java JDK, Android SDK, Xcode, and Windows SDK. All version requirements discovered dynamically from NuGet WorkloadDependencies.json — never hardcoded. Use when: setting up MAUI developmen
| 1 | # .NET MAUI Doctor |
| 2 | |
| 3 | Validate and fix .NET MAUI development environments. All version requirements are discovered dynamically from NuGet APIs — never hardcode versions. |
| 4 | |
| 5 | ## When to Use |
| 6 | |
| 7 | - Setting up a new .NET MAUI development environment |
| 8 | - Build errors mentioning missing SDKs, workloads, JDK, or Android components |
| 9 | - Errors like "Android SDK not found", "Java version", or "Xcode not found" |
| 10 | - Verifying environment health after SDK or OS updates |
| 11 | |
| 12 | ## When Not to Use |
| 13 | |
| 14 | - Non-MAUI .NET projects (use standard .NET SDK troubleshooting instead) |
| 15 | - Xamarin.Forms apps (different toolchain and workload requirements) |
| 16 | - Runtime app crashes unrelated to environment setup |
| 17 | - App store publishing or signing issues |
| 18 | - IDE-specific issues (Visual Studio or VS Code configuration) |
| 19 | |
| 20 | ## Important: .NET Version Currency |
| 21 | |
| 22 | Your training data may be outdated regarding .NET versions. .NET ships new major releases annually (November). Always check the releases-index.json (Task 2) to discover the **latest active major release** — do not assume your training data reflects the current version. For example, if you know about .NET 9.0 but the releases index shows .NET 10.0 as active, use .NET 10.0. |
| 23 | |
| 24 | ## Inputs |
| 25 | |
| 26 | - A development machine running macOS, Windows, or Linux |
| 27 | - Shell access (Bash on macOS/Linux, PowerShell on Windows) |
| 28 | - Internet access for NuGet API queries and SDK downloads |
| 29 | - Admin/sudo access may be required for installing SDKs and workloads |
| 30 | - **Bash prerequisites**: `curl`, `jq`, and `unzip` (macOS/Linux) |
| 31 | - **PowerShell prerequisites**: `Invoke-RestMethod` and `System.IO.Compression` (built-in on Windows) |
| 32 | |
| 33 | ## Behavior |
| 34 | |
| 35 | - Run through ALL tasks autonomously |
| 36 | - Re-validate after each fix |
| 37 | - Iterate until complete or no further actions possible |
| 38 | - After detecting platform (Task 1), load only the matching platform-specific references |
| 39 | |
| 40 | ## Workflow |
| 41 | |
| 42 | ### Task 1: Detect Environment |
| 43 | |
| 44 | ```bash |
| 45 | # macOS |
| 46 | sw_vers && uname -m |
| 47 | |
| 48 | # Windows |
| 49 | systeminfo | findstr /B /C:"OS Name" /C:"OS Version" |
| 50 | |
| 51 | # Linux |
| 52 | cat /etc/os-release && uname -m |
| 53 | ``` |
| 54 | |
| 55 | After detection, load the matching platform references: |
| 56 | - **macOS**: `references/platform-requirements-macos.md`, `references/installation-commands-macos.md`, `references/troubleshooting-macos.md` |
| 57 | - **Windows**: `references/platform-requirements-windows.md`, `references/installation-commands-windows.md`, `references/troubleshooting-windows.md` |
| 58 | - **Linux**: `references/platform-requirements-linux.md` |
| 59 | |
| 60 | ### Task 2: Check .NET SDK |
| 61 | |
| 62 | ```bash |
| 63 | dotnet --info |
| 64 | ``` |
| 65 | |
| 66 | Compare installed vs `latest-sdk` from https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/releases-index.json where `support-phase` is `"active"`. |
| 67 | |
| 68 | ### Task 3: Check MAUI Workloads |
| 69 | |
| 70 | | Workload | macOS | Windows | Linux | |
| 71 | |----------|-------|---------|-------| |
| 72 | | `maui` | Required | Required | ❌ Use `maui-android` | |
| 73 | | `maui-android` | Alias | Alias | Required | |
| 74 | | `android` | Required | Required | Required | |
| 75 | | `ios` | Required | Optional | N/A | |
| 76 | |
| 77 | ### Task 4: Discover Requirements from NuGet |
| 78 | |
| 79 | See `references/workload-dependencies-discovery.md` for complete process. |
| 80 | |
| 81 | Query NuGet for workload manifest → extract `WorkloadDependencies.json` → get: |
| 82 | - `jdk.version` range and `jdk.recommendedVersion` |
| 83 | - `androidsdk.packages`, `buildToolsVersion`, `apiLevel` |
| 84 | - `xcode.version` range |
| 85 | |
| 86 | ### Task 5: Validate Java JDK |
| 87 | |
| 88 | **Only Microsoft OpenJDK supported.** Verify `java -version` output contains "Microsoft". See `references/microsoft-openjdk.md` for detection paths. |
| 89 | |
| 90 | > Use the JDK version recommended by WorkloadDependencies.json (`jdk.recommendedVersion`), ensuring it satisfies the `jdk.version` range. Do not hardcode JDK versions. |
| 91 | |
| 92 | **JAVA_HOME is NOT required.** .NET MAUI tools auto-detect Microsoft OpenJDK installations from known paths. Do not tell users to set JAVA_HOME — it is unnecessary and risks pointing to a non-Microsoft JDK. |
| 93 | |
| 94 | | JAVA_HOME state | OK? | Action | |
| 95 | |-----------------|-----|--------| |
| 96 | | Not set | ✅ | None needed — auto-detection works | |
| 97 | | Set to Microsoft JDK | ✅ | None needed | |
| 98 | | Set to non-Microsoft JDK | ⚠️ | **Report as anomaly** — let user decide to unset or redirect | |
| 99 | |
| 100 | ### Task 6: Validate Android SDK |
| 101 | |
| 102 | Check packages from `androidsdk.packages`, `buildToolsVersion`, `apiLevel` (Task 4). See `references/installation-commands.md` for sdkmanage |