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

Microsoft.WindowsDesktop.App.Runtime pack should respect WinForms-Wpf profiles #37088

Closed
Tracked by #4649
LakshanF opened this issue Nov 21, 2023 · 1 comment
Closed
Tracked by #4649
Assignees
Labels
Area-NetSDK untriaged Request triage from a team member

Comments

@LakshanF
Copy link
Member

Describe the bug

Building a WinForms application causes Wpf assemblies to be pulled in since the Microsoft.WindowsDesktop.App.Runtime pack does not distinguish between WinForms-Wpf assemblies. However, the targeting pack Microsoft.WindowsDesktop.App.Ref, does distinguish between WinForms-Wpf assemblies.

A good description of the problem can be found here.

A possible solution is proposed by @AustinWise in the same issue here with detailed information on how the targeting pack respects WinForms profile, and with a suggestion on how the same approach could be applied to the runtime pack.

To Reproduce

  • dotnet new WinForms
  • dotnet publish --self-contained true

You should be able to see Wpf assemblies like PresentationFramework.dll in the published directory. Another option is to use static analysis tools like ILLinker or ILCompiler to show warnings stemming from Wpf assemblies. One such approach is outlined here.

Further technical details

Building trimmed and native AOT WinForms applications can be made easier without the Wpf assemblies. The size win is an additional advantage.

@LakshanF
Copy link
Member Author

The above 2 PR should now address this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-NetSDK untriaged Request triage from a team member
Projects
None yet
Development

No branches or pull requests

1 participant