Templates And Build Errors
Common Symptoms
| Symptom | Likely cause | Fix |
|---|---|---|
dotnet new winui not found | Templates not installed or wrong SDK environment | Recheck quickstart, install Microsoft.WindowsAppSDK.WinUI.CSharp.Templates, run dotnet new list winui |
| WinUI templates missing in Visual Studio | Workload missing or Visual Studio needs restart | Install WinUI application development workload and MSIX Packaging Tools |
| Build fails on Linux/macOS | WinUI 3 desktop app requires Windows tooling | Move validation to Windows machine |
| Target framework errors | Copied stale TFM or mismatched template/docs | Use generated template and current quickstart/release notes |
| XAML compiler errors | Namespace, resource, or generated code issue | Verify Microsoft.UI.Xaml, XAML build action, and generated files |
Diagnostic Commands
dotnet --info
dotnet new list winui
dotnet build --configuration Debug
dotnet build --configuration Release
Triage Rule
If the fix requires installing Visual Studio workloads, SDKs, runtime packages, or templates, ask before doing it in an agent session.