Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Profiles Attributes for Ref/Runtime Pack #4788

Merged
merged 2 commits into from
Nov 22, 2024
Merged

Fix Profiles Attributes for Ref/Runtime Pack #4788

merged 2 commits into from
Nov 22, 2024

Conversation

lonitra
Copy link
Member

@lonitra lonitra commented Nov 20, 2024

Related: #4708, #4789

In the ref pack WindowsFormsIntegration has profile WinForms and WPF when it should only be there when no profile is specified i.e. both UseWindowsForms and UseWPF 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. This is causing issues starting in .NET 9 where when <FrameworkReference Include="Microsoft.WindowsDesktop.App.WindowsForms" /> is added to winUI app, it is trying to pull in System.Xaml even though WinForms doesn't reference xaml. In .NET 8 there was no profile attribute so updated to remove profile attribute here.

In the runtime pack a majority of the FrameworkListFileClass with profile for WPF and WinForms is WPF specific. Updated these to be WPF only.

Validation:

  • Tested that this change fixes FrameworkReference Microsoft.WindowsDesktop.App.WindowsForms Incorrectly Includes WindowsFormsIntegration.dll #4789 by doing manual changes to FrameworkList.xml found in windowsdesktop ref pack and RuntimeList.xml found under path .nuget\packages\microsoft.windowsdesktop.app.runtime.<> and observing rebuilding repro project succeeds
  • Tested HW WPF/WinForms app runs as expected with manual changes to FrameworkList.xml/RuntimeList.xml
  • Tested HW WPF/WinForms app with trimming turned on runs as expected with manual changes to FrameworkList.xml/RuntimeList.xml
  • Tested published self contained WPF/WinForms app and produced runs .exe as expected with manual changes to FrameworkList.xml/RuntimeList.xml
  • Tested WPF apps hosting WinForms controls (UseWPF and UseWindowsForms both true) runs as expected with manual changes to FrameworkList.xml/RuntimeList.xml
  • Tested publishing self contained WPF app hosting WinForms controls (UseWPF and UseWindowsForms both true) and produced .exe runs as expected with manual changes to FrameworkList.xml/RuntimeList.xml
  • Compared FrameworkList.xml in msi produced by windowsdesktop build before and after change shows expected diff

@lonitra lonitra requested a review from LakshanF November 21, 2024 00:20
@LakshanF LakshanF requested a review from dsplaisted November 21, 2024 12:01
Copy link
Contributor

@LakshanF LakshanF left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@lonitra lonitra requested a review from JeremyKuhne November 22, 2024 01:49
@lonitra lonitra merged commit d212e0b into main Nov 22, 2024
8 checks passed
@lonitra lonitra deleted the fixprofile branch November 22, 2024 17:40
@@ -41,24 +35,34 @@
<FrameworkListFileClass Include="System.Windows.Forms.Design.resources.dll" Profile="WindowsForms" />
<FrameworkListFileClass Include="System.Windows.Forms.Primitives.resources.dll" Profile="WindowsForms" />
<FrameworkListFileClass Include="System.Windows.Forms.resources.dll" Profile="WindowsForms" />
<FrameworkListFileClass Include="System.Windows.Input.Manipulations.resources.dll" Profile="WindowsForms" />
<FrameworkListFileClass Include="System.Private.Windows.Core.dll" Profile="WindowsForms" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I noted in #4227 (review) this is the wrong way of doing this, Windows Forms owns the list, and it should be coming from dotnet/winforms instead of being manually maintained here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is what #4796 describes. Currently https://github.com/dotnet/winforms/blob/main/pkg/Microsoft.Private.Winforms/sdk/dotnet-windowsdesktop/System.Windows.Forms.FileClassification.props is only for the ref pack, we'll need to make adjustments to have it also be used for the runtime pack here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FrameworkReference Microsoft.WindowsDesktop.App.WindowsForms Incorrectly Includes WindowsFormsIntegration.dll
5 participants