Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions Workloads/winui/configuration.winget
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
22 changes: 22 additions & 0 deletions src/Workloads/winui/configuration.winget
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
65 changes: 55 additions & 10 deletions src/tests/winui/Program.cs
Original file line number Diff line number Diff line change
@@ -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();
});
}
}
27 changes: 3 additions & 24 deletions src/tests/winui/hello.csproj
Original file line number Diff line number Diff line change
@@ -1,27 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">

<!--
Minimal WinUI 3 (Windows App SDK) project used only as a hello-world probe
for CI. The `Microsoft.WindowsAppSDK` NuGet carries the WinUI build
targets and the `Microsoft.WinUI` projection assembly; the
`net10.0-windows10.0.19041.0` TFM pulls in the matching Windows SDK ref
pack. `WindowsPackageType=None` builds an unpackaged EXE so CI runners
can invoke it directly without needing to deploy an MSIX.

`AppxGeneratePriEnabled=false` skips WindowsAppSDK's `MrtCore.PriGen`
`AddPriPayloadFilesToCopyToOutputDirectoryItems` target, which otherwise
runs the `ExpandPriContent` MSBuild task. That task lives in
`Microsoft.Build.Packaging.Pri.Tasks.dll` under the .NET SDK's
`Microsoft\VisualStudio\v18.0\AppxPackage` path — not populated on
SDK-only builds (even with VS installed alongside, `dotnet build` uses
the SDK's own MSBuild directory, not VS's). Since this is an unpackaged
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.
-->

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0-windows10.0.19041.0</TargetFramework>
Expand All @@ -32,10 +9,12 @@
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<WindowsPackageType>None</WindowsPackageType>
<AppxGeneratePriEnabled>false</AppxGeneratePriEnabled>
<EnableMsixTooling>true</EnableMsixTooling>
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
<SelfContained>true</SelfContained>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.6.250205002" />
</ItemGroup>

</Project>
Loading