
Winui3 Migration Guide
Map legacy UWP APIs to Windows App SDK / WinUI 3 with namespace tables and before-after snippets so agent-generated desktop code stops using CoreWindow and Windows.UI.Xaml mistakes.
Overview
WinUI 3 Migration Guide is an agent skill for the Build phase that maps UWP APIs to Windows App SDK / WinUI 3 equivalents with namespace tables and before-after code snippets.
Install
npx skills add https://github.com/github/awesome-copilot --skill winui3-migration-guideWhat is this skill?
- Full namespace map from Windows.UI.Xaml.* to Microsoft.UI.Xaml.*
- Threading migration: CoreDispatcher → DispatcherQueue
- Windowing migration: CoreWindow → AppWindow
- Coverage of dialogs, pickers, sharing, printing, and background tasks
- Documents top Copilot mistakes including ContentDialog XamlRoot requirements
- Documents top 3 most common Copilot mistakes for WinUI 3
Adoption & trust: 5.4k installs on skills.sh; 34.6k GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
Your agent keeps generating UWP namespaces and CoreWindow patterns that do not compile or behave correctly in a WinUI 3 desktop app.
Who is it for?
Indie Windows desktop authors porting UWP apps or reviewing Copilot output against official WinUI 3 surfaces.
Skip if: Greenfield web or cross-platform Flutter/React Native projects with no Windows App SDK XAML stack.
When should I use this skill?
Migrating UWP apps to WinUI 3 / Windows App SDK, or verifying generated code uses Microsoft.UI.Xaml instead of legacy UWP APIs.
What do I get? / Deliverables
You replace legacy calls with documented WinUI 3 equivalents so migrated screens, dialogs, and windowing code align with Windows App SDK expectations.
- Corrected API usage snippets
- Namespace and threading/windowing migration notes applied to target files
Recommended Skills
Journey fit
Build is where you rewrite UI layers and APIs during a UWP-to-WinUI 3 port or when validating Copilot output against real SDK surfaces. Frontend subphase fits XAML UI, controls, dialogs, windowing, and dispatcher patterns—not backend services.
How it compares
Reference migration tables for WinUI—not a generic C# refactor skill or an MCP server for Microsoft docs.
Common Questions / FAQ
Who is winui3-migration-guide for?
Solo developers and small shops maintaining Windows desktop apps who need accurate UWP-to-WinUI 3 API mappings while coding with Copilot, Cursor, or Claude.
When should I use winui3-migration-guide?
During Build → frontend while porting XAML pages, fixing dispatcher/windowing code, or validating generated snippets before you commit a migration PR.
Is winui3-migration-guide safe to install?
It is documentation-style guidance with no inherent shell or secret access; review the Security Audits panel on this Prism page for the parent awesome-copilot package.
SKILL.md
READMESKILL.md - Winui3 Migration Guide
# WinUI 3 Migration Guide Use this skill when migrating UWP apps to WinUI 3 / Windows App SDK, or when verifying that generated code uses correct WinUI 3 APIs instead of legacy UWP patterns. --- ## Namespace Changes All `Windows.UI.Xaml.*` namespaces move to `Microsoft.UI.Xaml.*`: | UWP Namespace | WinUI 3 Namespace | |--------------|-------------------| | `Windows.UI.Xaml` | `Microsoft.UI.Xaml` | | `Windows.UI.Xaml.Controls` | `Microsoft.UI.Xaml.Controls` | | `Windows.UI.Xaml.Media` | `Microsoft.UI.Xaml.Media` | | `Windows.UI.Xaml.Input` | `Microsoft.UI.Xaml.Input` | | `Windows.UI.Xaml.Data` | `Microsoft.UI.Xaml.Data` | | `Windows.UI.Xaml.Navigation` | `Microsoft.UI.Xaml.Navigation` | | `Windows.UI.Xaml.Shapes` | `Microsoft.UI.Xaml.Shapes` | | `Windows.UI.Composition` | `Microsoft.UI.Composition` | | `Windows.UI.Input` | `Microsoft.UI.Input` | | `Windows.UI.Colors` | `Microsoft.UI.Colors` | | `Windows.UI.Text` | `Microsoft.UI.Text` | | `Windows.UI.Core` | `Microsoft.UI.Dispatching` (for dispatcher) | --- ## Top 3 Most Common Copilot Mistakes ### 1. ContentDialog Without XamlRoot ```csharp // ❌ WRONG — Throws InvalidOperationException in WinUI 3 var dialog = new ContentDialog { Title = "Error", Content = "Something went wrong.", CloseButtonText = "OK" }; await dialog.ShowAsync(); ``` ```csharp // ✅ CORRECT — Set XamlRoot before showing var dialog = new ContentDialog { Title = "Error", Content = "Something went wrong.", CloseButtonText = "OK", XamlRoot = this.Content.XamlRoot // Required in WinUI 3 }; await dialog.ShowAsync(); ``` ### 2. MessageDialog Instead of ContentDialog ```csharp // ❌ WRONG — UWP API, not available in WinUI 3 desktop var dialog = new Windows.UI.Popups.MessageDialog("Are you sure?", "Confirm"); await dialog.ShowAsync(); ``` ```csharp // ✅ CORRECT — Use ContentDialog var dialog = new ContentDialog { Title = "Confirm", Content = "Are you sure?", PrimaryButtonText = "Yes", CloseButtonText = "No", XamlRoot = this.Content.XamlRoot }; var result = await dialog.ShowAsync(); if (result == ContentDialogResult.Primary) { // User confirmed } ``` ### 3. CoreDispatcher Instead of DispatcherQueue ```csharp // ❌ WRONG — CoreDispatcher does not exist in WinUI 3 await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { StatusText.Text = "Done"; }); ``` ```csharp // ✅ CORRECT — Use DispatcherQueue DispatcherQueue.TryEnqueue(() => { StatusText.Text = "Done"; }); // With priority: DispatcherQueue.TryEnqueue(DispatcherQueuePriority.High, () => { ProgressBar.Value = 100; }); ``` --- ## Windowing Migration ### Window Reference ```csharp // ❌ WRONG — Window.Current does not exist in WinUI 3 var currentWindow = Window.Current; ``` ```csharp // ✅ CORRECT — Use a static property in App public partial class App : Application { public static Window MainWindow { get; private set; } protected override void OnLaunched(LaunchActivatedEventArgs args) { MainWindow = new MainWindow(); MainWindow.Activate(); } } // Access anywhere: App.MainWindow ``` ### Window Management | UWP API | WinUI 3 API | |---------|-------------| | `ApplicationView.TryResizeView()` | `AppWindow.Resize()` | | `AppWindow.TryCreateAsync()` | `AppWindow.Create()` | | `AppWindow.TryShowAsync()` | `AppWindow.Show()` | | `AppWindow.TryConsolidateAsync()` | `AppWindow.Destroy()` | | `AppWindow.RequestMoveXxx()` | `AppWindow.Move()` | | `AppWindow.GetPlacement()` | `AppWindow.Position` property | | `AppWindow.RequestPresentation()` | `AppWindow.SetPresent