[release/9.0] Fix Profiles Attributes for Ref/Runtime Pack #4795
+24
−16
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport of #4788
Customer Impact
Customers that have
<FrameworkReference Include="Microsoft.WindowsDesktop.App.WindowsForms" />
in their winUI project or references packages that pulls same dlls as package Microsoft.WindowsDesktop.App.WindowsForms are no longer able to build successfully since this specifies WindowsForms profile, which now pulls in dlls that need to resolve System.Xaml when WinForms does not reference xaml. Specifically, adding the package reference now pulls in WindowsFormsIntegration.dll which should only be present when no profile is specified i.e. when users have both and in their project. This behavior has regressed since .NET 8Additionally, when publishing a self-contained WinForms app, customers will have unnecessary dlls present that are not used by WinForms at all.
These issues are now occurring in .NET 9 because we had updated all dlls in both the runtime/ref pack to have a specified profile to support respecting profiles when publish self-contained winforms/wpf app. In the process of doing this, we had mis profiled a few dlls causing them to be pulled in when they shouldn't be for certain scenarios.
Testing
FrameworkList.xml
found in windowsdesktop ref pack andRuntimeList.xml
found under path .nuget\packages\microsoft.windowsdesktop.app.runtime.<> to be the same as above FrameworkList.xml/RuntimeList.xml and observing rebuilding repro project succeedsUseWPF
andUseWindowsForms
both true) runs as expected with the manual changes to FrameworkList.xml/RuntimeList.xmlUseWPF
andUseWindowsForms
both true) and produced .exe runs as expected with the manual changes to FrameworkList.xml/RuntimeList.xmlRisk
Low. The change corrects the mis profiled dlls in the ref/runtime pack and validation in various scenarios done to make sure there are no regressions.