Skip to content

Add winui-uwp-migration skill#88

Open
niels9001 wants to merge 1 commit into
microsoft:stagingfrom
niels9001:add-winui-uwp-migration-skill
Open

Add winui-uwp-migration skill#88
niels9001 wants to merge 1 commit into
microsoft:stagingfrom
niels9001:add-winui-uwp-migration-skill

Conversation

@niels9001
Copy link
Copy Markdown
Collaborator

Adds a new winui-uwp-migration skill to the winui plugin, covering migration from UWP to WinUI 3 / Windows App SDK.

The skill is modeled after the existing winui-wpf-migration skill (same structure: process steps, critical rules, checklist, post-migration validation) and pulls content from the official Microsoft Learn migration documentation under /migrate-to-windows-app-sdk/.

What's covered

  • Before you start: unsupported features (CoreWindow, InkCanvas, gamepad VKs, single-app kiosk, Xbox/HoloLens), .NET Upgrade Assistant, Win32 App Isolation
  • Namespace replacement Windows.UI.Xaml.*Microsoft.UI.Xaml.*
  • Top 3 Copilot mistakes with before/after: ContentDialog without XamlRoot, MessageDialogContentDialog, CoreDispatcherDispatcherQueue
  • Windowing: Window.Current / ApplicationView / CoreWindowAppWindow
  • GetForCurrentView() replacements (window-scoped, not view-scoped)
  • Pickers / Share / Print: InitializeWithWindow.Initialize(obj, hwnd)
  • App lifecycle: AppInstance.GetActivatedEventArgs, single-instancing
  • Background tasks: BackgroundTaskBuilder (WinAppSDK 1.7)
  • Notifications: AppNotificationManager, PushNotificationManager
  • MRT → MRT Core, DirectWrite → DWriteCore
  • Control swaps: MediaElementMediaPlayerElement, MapControl, CameraCaptureUI, WebAuthenticationBroker → OAuth, DesktopAcrylicController
  • Test projects: Unit Test App (WinUI in Desktop) + [UITestMethod]
  • Project file updates, storage/settings, 22-step checklist, post-migration validation script, References section linking back to the Learn guides

Motivation

UWP-trained suggestions remain a major source of incorrect WinUI 3 code (MessageDialog, CoreDispatcher, Window.Current, GetForCurrentView, dialogs without XamlRoot, pickers without window handles). A dedicated migration skill complements winui-wpf-migration so the agent loads the right rules when the source is UWP rather than WPF.

Files

  • plugins/winui/skills/winui-uwp-migration/SKILL.md (new)
  • CHANGELOG.md — entry under [Unreleased] → Added

Checklist

  • Targets staging (not main)
  • No version fields touched
  • [Unreleased] entry added
  • Frontmatter follows the same schema as winui-wpf-migration

Adds a UWP to WinUI 3 / Windows App SDK migration skill covering namespace replacement, dispatcher/windowing/dialog/picker fixes, GetForCurrentView replacements, MRT Core, DWriteCore, BackgroundTaskBuilder, notifications, control swaps (MediaElement to MediaPlayerElement, etc.), unsupported-feature warnings, and a step-by-step checklist. Content draws from the official Microsoft Learn migration guides under /migrate-to-windows-app-sdk/.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@niels9001 niels9001 requested review from Copilot and nmetulev and removed request for nmetulev May 19, 2026 20:37
Copy link
Copy Markdown

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

Note

Copilot was unable to run its full agentic suite in this review.

Adds a new winui-uwp-migration skill to the winui plugin, providing structured guidance for migrating UWP applications to WinUI 3 / Windows App SDK.

Changes:

  • New SKILL.md documenting UWP → WinUI 3 migration (namespaces, dispatcher, windowing, dialogs, pickers, notifications, controls, tests, etc.)
  • Adds matching [Unreleased] → Added entry to CHANGELOG.md

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

File Description
plugins/winui/skills/winui-uwp-migration/SKILL.md New skill content with process steps, mapping tables, critical rules, checklist, and validation script
CHANGELOG.md Unreleased entry describing the new skill

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

| UWP | WinUI 3 / WinAppSDK |
|-----|---------------------|
| `MediaElement` | `MediaPlayerElement` (Microsoft.UI.Xaml.Controls) |
| `MediaPlayerElement` (Windows.UI.Xaml) | `MediaPlayerElement` (Microsoft.UI.Xaml.Controls) — namespace change only |
|-----|---------------------|
| `MediaElement` | `MediaPlayerElement` (Microsoft.UI.Xaml.Controls) |
| `MediaPlayerElement` (Windows.UI.Xaml) | `MediaPlayerElement` (Microsoft.UI.Xaml.Controls) — namespace change only |
| `MapControl` (Windows.UI.Xaml.Controls.Maps) | `MapControl` (Microsoft.UI.Xaml.Controls) — WinAppSDK 1.5+ |

### Step 16: Project File Updates

- Target `net10.0-windows10.0.22621.0` (or current WinAppSDK-supported TFM).
Comment on lines +141 to +150
| 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.RequestPresentation` | `AppWindow.SetPresenter` |
| `CoreApplicationViewTitleBar` | `AppWindowTitleBar` |
| `CoreApplicationView.TitleBar.ExtendViewIntoTitleBar` | `AppWindow.TitleBar.ExtendsContentIntoTitleBar` |
Comment on lines +180 to +190
`OnLaunched`, `OnActivated`, `OnFileActivated`, etc. on `Application` are replaced by the unified `AppInstance` / `AppLifecycle` activation model. See the [app lifecycle guide](https://learn.microsoft.com/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/applifecycle).

```csharp
using Microsoft.Windows.AppLifecycle;

var args = AppInstance.GetCurrent().GetActivatedEventArgs();
switch (args.Kind)
{
case ExtendedActivationKind.File: /* ... */ break;
case ExtendedActivationKind.Protocol: /* ... */ break;
case ExtendedActivationKind.AppNotification: /* toast click */ break;
- ❌ NEVER use `MediaElement` — use `MediaPlayerElement`.
- ❌ NEVER assume `InkCanvas`, gamepad VKs, or `CoreWindow` will compile — they're not supported.
- ✅ Always cache one `DispatcherQueue` per window; watch for reentrancy in async code that pumps messages.
- ✅ Always use `winapp run` to launch — never run the `.exe` directly.
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.

2 participants