Feasabilty of enabling Trim on WinForms by manually providing the roots file?
- Dominant language
- C#
- Stars
- 4.9k
- Forks
- 1.1k
- Avg merge
- 1d 13m
- Merged PRs (30d)
- 85
Description
### .NET version
.NET Runtime 6.0
### Did it work in .NET Framework?
Yes
### Did it work in any of the earlier releases of .NET Core or .NET 5+?
N/A
### Issue description
Discussion tag please
This documentation describes how to provide a list of assemblies to preserve: https://github.com/dotnet/linker/blob/main/docs/data-formats.md
We have a large .NET Runtime application that is mostly ASP.NET Core, but also some Console, and a single small WinForms application whose sole purpose is to edit the configuration files. The team is really excited about trimmed single files and wants to publish the whole application to single file depolyment if possible. I've already solved the problem of how to amalgamate a bunch of applications to a single build for single file deployment.
What's the feasibility of manually providing the roots for COM interop endpoints so that ILLink sees them as rooted and doesn't remove them? The winforms application is so small we can walk all events on all controls in less than an hour and know full well whether it works or not.
All controls used in no particular order:
* Button
* ListView
* TextBox
* Label
* Panel
* TabControl
* DataGridView (It's given a list of objects with string properties, no DataSet used anywhere)
* ComboBox
* TextBox
* CheckBox
* RichTextBox (mistake: a TextBox should have been used and I'll gladly switch it if it saves trouble)
Originally we shipped the Winforms binary as a .NET Framework binary; however we can no longer do so as this caused two issues:
* It is not possibly to load .NET Runtime assemblies from .NET Framework anymore, even to reflect on them rather than run code in them.
* The application did not work on Windows Server Core. We have since gone out of our way to make the config tool run on Server Core with the .NET Core/Runtime version of WinForms.
### Steps to reproduce
N/A
Contributor guide
Assessment
This issue has not been assessed yet.