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

Both options for creating .NET 6 WinForms builds have serious show stoppers #22763

Open
TangibleDave opened this issue Nov 24, 2021 · 9 comments
Milestone

Comments

@TangibleDave
Copy link

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:

  1. trimming restored for WinForms applications in .NET 6 (it worked fine in .NET 5)
    or:
  2. the critical error message for installing .NET 6 reworked to something less scary for less sophisticated users

As it is, there is no way I can publish .NET 6 versions of our utilities.

@RussKie
Copy link
Member

RussKie commented Nov 24, 2021

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 (dotnet/winforms#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 dotnet/docs#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.

@RussKie RussKie transferred this issue from dotnet/winforms Nov 24, 2021
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-NetSDK untriaged Request triage from a team member labels Nov 24, 2021
@TangibleDave
Copy link
Author

DotnetRuntimeBootstrapper looks promising, but it adds another reliance on a third party tool (with its unknown security risks and unpredictable support).

@sfoslund
Copy link
Member

@baronfel do you have any thoughts on the critical error message feedback?

@sfoslund sfoslund removed the untriaged Request triage from a team member label Nov 30, 2021
@sfoslund sfoslund removed their assignment Nov 30, 2021
@sfoslund sfoslund added this to the Backlog milestone Nov 30, 2021
@baronfel
Copy link
Member

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?):

image

If you click 'yes' there, you get dropped on this page:

image

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.

@TangibleDave
Copy link
Author

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.

@RussKie
Copy link
Member

RussKie commented Nov 30, 2021

image

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.

@baronfel
Copy link
Member

baronfel commented Nov 30, 2021

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.

@kant2002
Copy link

kant2002 commented Dec 2, 2021

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.

@nicko88
Copy link

nicko88 commented Feb 22, 2022

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.

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

No branches or pull requests

6 participants