diff --git a/Workloads/winui/configuration.winget b/Workloads/winui/configuration.winget index e7fb4bb..174bf56 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: @@ -94,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 e7fb4bb..174bf56 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: @@ -94,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/Program.cs b/src/tests/winui/Program.cs index af88d97..c007898 100644 --- a/src/tests/winui/Program.cs +++ b/src/tests/winui/Program.cs @@ -1,12 +1,57 @@ -// 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 -// 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. - 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 958ee01..ab3036f 100644 --- a/src/tests/winui/hello.csproj +++ b/src/tests/winui/hello.csproj @@ -1,27 +1,4 @@ - - - Exe net10.0-windows10.0.19041.0 @@ -32,10 +9,12 @@ false None false + true + true + true -