From 8c69a9fe98f346f5e873ae5e2f92c5ef7d66471a Mon Sep 17 00:00:00 2001 From: AmirMS <104940545+AmelBawa-msft@users.noreply.github.com> Date: Mon, 1 Jun 2026 17:34:43 -0700 Subject: [PATCH 1/4] Fix winget files --- Workloads/winui/configuration.winget | 11 +++++++++++ src/Workloads/winui/configuration.winget | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/Workloads/winui/configuration.winget b/Workloads/winui/configuration.winget index e7fb4bb..65f4041 100644 --- a/Workloads/winui/configuration.winget +++ b/Workloads/winui/configuration.winget @@ -72,6 +72,17 @@ resources: winget: securityContext: elevated + - type: Microsoft.WinGet/Package + name: DotNetSdk + properties: + id: Microsoft.DotNet.SDK.10 + source: winget + acceptAgreements: true + metadata: + description: Install .NET SDK 10 + winget: + securityContext: elevated + - type: Microsoft.WinGet/Package name: VisualStudio properties: diff --git a/src/Workloads/winui/configuration.winget b/src/Workloads/winui/configuration.winget index e7fb4bb..65f4041 100644 --- a/src/Workloads/winui/configuration.winget +++ b/src/Workloads/winui/configuration.winget @@ -72,6 +72,17 @@ resources: winget: securityContext: elevated + - type: Microsoft.WinGet/Package + name: DotNetSdk + properties: + id: Microsoft.DotNet.SDK.10 + source: winget + acceptAgreements: true + metadata: + description: Install .NET SDK 10 + winget: + securityContext: elevated + - type: Microsoft.WinGet/Package name: VisualStudio properties: From d15ef9ce01c029df335714412fa386f21359edb2 Mon Sep 17 00:00:00 2001 From: AmirMS <104940545+AmelBawa-msft@users.noreply.github.com> Date: Mon, 1 Jun 2026 17:59:04 -0700 Subject: [PATCH 2/4] Fix winget files --- Workloads/winui/configuration.winget | 11 +++++++++++ src/Workloads/winui/configuration.winget | 11 +++++++++++ src/tests/winui/hello.csproj | 3 +++ 3 files changed, 25 insertions(+) diff --git a/Workloads/winui/configuration.winget b/Workloads/winui/configuration.winget index 65f4041..174bf56 100644 --- a/Workloads/winui/configuration.winget +++ b/Workloads/winui/configuration.winget @@ -105,6 +105,17 @@ resources: winget: securityContext: elevated + - type: Microsoft.WinGet/Package + name: WindowsAppRuntime + properties: + id: Microsoft.WindowsAppRuntime.1.6 + source: winget + acceptAgreements: true + metadata: + description: Install the Windows App Runtime 1.6 + winget: + securityContext: elevated + - type: Microsoft.DSC.Transitional/RunCommandOnSet name: VSWorkloads dependsOn: diff --git a/src/Workloads/winui/configuration.winget b/src/Workloads/winui/configuration.winget index 65f4041..174bf56 100644 --- a/src/Workloads/winui/configuration.winget +++ b/src/Workloads/winui/configuration.winget @@ -105,6 +105,17 @@ resources: winget: securityContext: elevated + - type: Microsoft.WinGet/Package + name: WindowsAppRuntime + properties: + id: Microsoft.WindowsAppRuntime.1.6 + source: winget + acceptAgreements: true + metadata: + description: Install the Windows App Runtime 1.6 + winget: + securityContext: elevated + - type: Microsoft.DSC.Transitional/RunCommandOnSet name: VSWorkloads dependsOn: diff --git a/src/tests/winui/hello.csproj b/src/tests/winui/hello.csproj index 958ee01..70e0e03 100644 --- a/src/tests/winui/hello.csproj +++ b/src/tests/winui/hello.csproj @@ -32,6 +32,9 @@ false None false + true + true + true From d7e8bb31b039bbac25974e4ce7580dc7145f852d Mon Sep 17 00:00:00 2001 From: AmirMS <104940545+AmelBawa-msft@users.noreply.github.com> Date: Mon, 1 Jun 2026 18:07:26 -0700 Subject: [PATCH 3/4] Update the test --- src/tests/winui/Program.cs | 69 ++++++++++++++++++++++++++++++++---- src/tests/winui/hello.csproj | 6 ++-- 2 files changed, 67 insertions(+), 8 deletions(-) diff --git a/src/tests/winui/Program.cs b/src/tests/winui/Program.cs index af88d97..c881304 100644 --- a/src/tests/winui/Program.cs +++ b/src/tests/winui/Program.cs @@ -1,12 +1,69 @@ // Hello-world probe for the WinUI 3 flow. // -// We don't show a window (CI runners are headless for interactive UI), but we -// *do* reference a WinUI type and read back its name — this forces the +// Boots a minimal WinUI 3 Application, opens a top-level Window, and shows a +// ContentDialog whose body carries the same "WinUI: Application" content the +// previous console build wrote to stdout. The dialog text is derived from +// `typeof(Microsoft.UI.Xaml.Application).Name`, which still forces the // Microsoft.WinUI projection assembly (shipped by the Microsoft.WindowsAppSDK -// NuGet) to actually load. If the WinAppSDK restore was incomplete, the -// `typeof` below would fail and the harness would flag the flow broken. +// NuGet) to actually load before any UI appears — if the WinAppSDK restore +// was incomplete the typeof below would fail and the dialog would never open. +// +// The app exits as soon as the dialog's close button is clicked. using System; +using Microsoft.UI.Dispatching; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; + +namespace HelloWinUI; + +public class App : Application +{ + private Window? _window; + + protected override void OnLaunched(LaunchActivatedEventArgs args) + { + var root = new Grid(); + _window = new Window + { + Title = "WinUI", + Content = root, + }; + + root.Loaded += OnRootLoaded; + _window.Activate(); + } + + private async void OnRootLoaded(object sender, RoutedEventArgs e) + { + var root = (FrameworkElement)sender; + root.Loaded -= OnRootLoaded; + + var dialog = new ContentDialog + { + XamlRoot = root.XamlRoot, + Title = "WinUI", + Content = $"WinUI: {typeof(Application).Name}", + CloseButtonText = "OK", + }; + + await dialog.ShowAsync(); + _window?.Close(); + Exit(); + } +} -var name = typeof(Microsoft.UI.Xaml.Application).Name; -Console.WriteLine($"WinUI: {name}"); +public static class Program +{ + [STAThread] + public static void Main() + { + Application.Start(p => + { + var context = new DispatcherQueueSynchronizationContext( + DispatcherQueue.GetForCurrentThread()); + System.Threading.SynchronizationContext.SetSynchronizationContext(context); + _ = new App(); + }); + } +} diff --git a/src/tests/winui/hello.csproj b/src/tests/winui/hello.csproj index 70e0e03..29e1aaa 100644 --- a/src/tests/winui/hello.csproj +++ b/src/tests/winui/hello.csproj @@ -18,8 +18,10 @@ hello-world probe that doesn't emit or consume any .pri resources, skipping PRI work is safe and keeps the command-line build green. - Program.cs references `Microsoft.UI.Xaml.Application` to prove the WinUI - projection actually loads before printing the expected stdout. + Program.cs boots a minimal WinUI 3 Application that opens a Window and + shows a ContentDialog carrying `WinUI: `. Touching + `Microsoft.UI.Xaml.Application` still proves the WinUI projection actually + loads before any UI appears. --> From 22331c5fad64afe9490f84aabad0bc14f604add2 Mon Sep 17 00:00:00 2001 From: AmirMS <104940545+AmelBawa-msft@users.noreply.github.com> Date: Mon, 1 Jun 2026 18:09:07 -0700 Subject: [PATCH 4/4] Remove comments --- src/tests/winui/Program.cs | 12 ------------ src/tests/winui/hello.csproj | 26 -------------------------- 2 files changed, 38 deletions(-) diff --git a/src/tests/winui/Program.cs b/src/tests/winui/Program.cs index c881304..c007898 100644 --- a/src/tests/winui/Program.cs +++ b/src/tests/winui/Program.cs @@ -1,15 +1,3 @@ -// Hello-world probe for the WinUI 3 flow. -// -// Boots a minimal WinUI 3 Application, opens a top-level Window, and shows a -// ContentDialog whose body carries the same "WinUI: Application" content the -// previous console build wrote to stdout. The dialog text is derived from -// `typeof(Microsoft.UI.Xaml.Application).Name`, which still forces the -// Microsoft.WinUI projection assembly (shipped by the Microsoft.WindowsAppSDK -// NuGet) to actually load before any UI appears — if the WinAppSDK restore -// was incomplete the typeof below would fail and the dialog would never open. -// -// The app exits as soon as the dialog's close button is clicked. - using System; using Microsoft.UI.Dispatching; using Microsoft.UI.Xaml; diff --git a/src/tests/winui/hello.csproj b/src/tests/winui/hello.csproj index 29e1aaa..ab3036f 100644 --- a/src/tests/winui/hello.csproj +++ b/src/tests/winui/hello.csproj @@ -1,29 +1,4 @@ - - - Exe net10.0-windows10.0.19041.0 @@ -42,5 +17,4 @@ -