Open TangibleDave opened 3 years ago
There're other options too, e.g. https://github.com/Tyrrrz/DotnetRuntimeBootstrapper.
The trimming is not currently supported for Windows Desktop apps due to an extensive dependence on COM and reflection, which are not trim-safe (https://github.com/dotnet/winforms/issues/4649). And if it worked it would be "accidental" (https://twitter.com/andygocke/status/1455320377387732994). I raised an issue for the docs to be updated to reflect the current state https://github.com/dotnet/docs/issues/27274.
AFAIK this is being worked on, and if all goes well desktop apps may be trimmable in .NET 7.
Moving to the SDK to consider the error message feedback.
DotnetRuntimeBootstrapper looks promising, but it adds another reliance on a third party tool (with its unknown security risks and unpredictable support).
@baronfel do you have any thoughts on the critical error message feedback?
For posterity, here's a snap of what the missing-runtime error looks like on Windows 11 when you run a framework-dependent winforms app (and presumably any framework-dependent app?):
If you click 'yes' there, you get dropped on this page:
I've been using .NET (Core) since it released, and I don't know what the correct answer is in that case. I'm guessing the 'desktop' runtime here, but end users who get this message box aren't going to know that. I definitely think there's room for improvement here, but I'm not sure who owns each part of that experience.
I can't see how that's acceptable - if I try to install a Java application and don't have Java installed I don't think it's this ugly.
IIRC (it's been a while) but if a user lacked a specific .NET Framework version (e.g. 3.5) by clicking "Yes" we'd start a download of NETFx 3.5 runtime. Perhaps we could somehow do the same - we do know what OS and bitness an app is being run on (e.g. Window 10, arm64) and what SDK the app is targeting (e.g. a Console or Windows Desktop), and we could deduce a download link from this information.
Perhaps we could somehow do the same - we do know what OS and bitness an app is being run on (e.g. Window 10, arm64) and what SDK the app is targeting (e.g. a Console or Windows Desktop), and we could deduce a download link from this information.
That would be great to get back to that experience. This is a apphost-level thing (see the error dialog code here), so tagging @richlander for input here.
AFAIK this is being worked on, and if all goes well desktop apps may be trimmable in .NET 7.
@RussKie who is this lovely person whom I should send infinite hugs? Just want to track progress if possible.
AFAIK this is being worked on, and if all goes well desktop apps may be trimmable in .NET 7.
Any progress on this with .NET 7 Preview 1 released recently?
I am also still using .NET 5 because it works to trim my WinForms app and is way smaller (like 3x smaller) than compiled with .NET 6.
I would prefer to create a single-file self-contained install for a WinForms application using .NET 6. However, the removal of trimming in .NET 6 for WinForms applications means that the size of the install is impractical (>100MB - that's just insane for our utilities). With trimming in .NET 5, the size was large, but acceptable.
The "framework-dependent" option is also not practical due to the critical error message (red 'x', etc.) that comes up if .NET 6 is not already installed. This will always scare off a certain percentage of users.
I would like either:
As it is, there is no way I can publish .NET 6 versions of our utilities.