unzip and build project via command line with msbuild -p:platform=x64 -bl
Observe failure about trying to resolve System.Xaml
If we look at the binlog, failure occurs under MarkupCompilePass1 target, specifically in CompileXaml task. For that task, if we look at Parameters > ReferenceAssemblies we can see WindowsFormsIntegration.dll
If we search ReferencePath (this is what the ReferenceAssemblies parameter is in the targets file), we can see WindowsFormsIntegration.dll first gets added in ResolveAssemblyReferences target, specifically ResolveAssemblyReference task
In .NET 8 binlog which is included in zip observe WindowsFormsIntegration.dll is not included in ReferencePath
In .NET 9 we are experiencing issues where when adding
<FrameworkReference Include="Microsoft.WindowsDesktop.App.WindowsForms" />
in a winUI project and building, it tries to resolve System.Xaml even though WinForms does not reference Xaml. This is occurring because we had changedWindowsFormsIntegration.dll
to have profile with WPF and WindowsForms causingResolveAssemblyReferences
target to include WindowsFormsIntegration.dll in references thus pulling this .dll in even though it is only intended when no profile is specified i.e.UseWindowsForms
andUseWPF
is true as indicated in https://github.com/dotnet/wpf/blob/bbfc24fd13804a191e20064acd599b0a359092df/packaging/Microsoft.NET.Sdk.WindowsDesktop/targets/Microsoft.NET.Sdk.WindowsDesktop.props#L45-L46. In .NET 8 there was no profile attribute for this dll.We had made this update as part of https://github.com/dotnet/windowsdesktop/pull/4227 to support runtime pack respecting profiles when publish self contained winforms/wpf app (https://github.com/dotnet/sdk/issues/37088)
Repro project: App11.zip
Repro steps:
msbuild -p:platform=x64 -bl
MarkupCompilePass1
target, specifically inCompileXaml
task. For that task, if we look at Parameters > ReferenceAssemblies we can see WindowsFormsIntegration.dllReferencePath
(this is what the ReferenceAssemblies parameter is in the targets file), we can see WindowsFormsIntegration.dll first gets added inResolveAssemblyReferences
target, specificallyResolveAssemblyReference
taskReferencePath
More info: This was originally reported via https://github.com/dotnet/maui/issues/25883 but scenario can be simplified which is what the repro project demonstrates