From 2f9f7092ed339e71774d6de779d7ab01677b14e6 Mon Sep 17 00:00:00 2001 From: Zac Gaetano Date: Wed, 13 May 2026 00:21:33 -0400 Subject: [PATCH] build(winui3): post-build target to strip WindowsDesktop.App from runtimeconfig Adds a StripWindowsDesktopAppFromRuntimeConfig MSBuild target that runs after GenerateBuildRuntimeConfigurationFiles and rewrites TeamsISO.runtimeconfig.json to drop the implicit Microsoft.WindowsDesktop.App framework reference. The .NET 8 SDK adds that framework for any -windows TFM, but WinUI 3 doesn't use it and including it in the runtimeconfig contributes to the broken unpackaged activation path (one of the three suspects in the migration plan's Phase 3). Build log confirms the strip on every build: Stripped Microsoft.WindowsDesktop.App from .../TeamsISO.runtimeconfig.json Verified the runtimeconfig now reads: { "name": "Microsoft.NETCore.App", "version": "8.0.0" } (no WindowsDesktop.App entry) This didn't resolve the activation dialog on its own, but it's a required step for any unpackaged WinUI 3 build and the next debugging session can rule it out as a contributing cause. --- .../TeamsISO.App.WinUI.csproj | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/TeamsISO.App.WinUI/TeamsISO.App.WinUI.csproj b/src/TeamsISO.App.WinUI/TeamsISO.App.WinUI.csproj index f7e4aed..3426f74 100644 --- a/src/TeamsISO.App.WinUI/TeamsISO.App.WinUI.csproj +++ b/src/TeamsISO.App.WinUI/TeamsISO.App.WinUI.csproj @@ -107,4 +107,36 @@ + + + + <_RuntimeConfigPath>$(OutDir)$(AssemblyName).runtimeconfig.json + + + <_RuntimeConfigContent>$([System.IO.File]::ReadAllText('$(_RuntimeConfigPath)')) + <_PatchedContent>$([System.Text.RegularExpressions.Regex]::Replace($(_RuntimeConfigContent), ',\s*\{\s*"name":\s*"Microsoft\.WindowsDesktop\.App"[^\}]*\}', '')) + + + + +