Hacker News new | ask | show | jobs
by giulianob 2222 days ago
Trimming is already supported and they're investing heavily into making it more aggressive. A web app was about 17mb in one of the demos at the conference that I saw. You can get it smaller if you make it more aggressive yourself but you may have to whitelist specific namespaces if it accidentally removes that you're using that it can't detect.
2 comments

I would consider this still VERY big. It's ok for backend stuff. But now you can also use .NET --Core-- with WinForms, WPF and WinUI. That means, GUI Apps.

You'll have several GUI apps installed on user system...

UWP already handled that years ago, thought.

.msix/.appx supports dependency properly. If the app target's a new .NET version, and it doesn't have downloaded, it just.... download automatically on install. UWP .NET on Windows it's also inside .appx packages.

Not every use-case has an always available high-bandwidth internet connection.
Yeah, I often use this feature for "small" utility programs that I want to copy around without an installer and just want to make sure they work without trouble.
How do you make it more aggressive? Are there options in project file?
With the right flags you can get Hello World down to about 2MB of managed assemblies. You will still have about 16 MB of native:

https://github.com/AustinWise/IlLinkerExample

You basically have to directly fiddle with the flags to the IL linker to really get the size down. It's a pain. They are working on designs to make it better:

https://github.com/dotnet/designs/pull/123

I think these changes can make self contained .NET apps compare more favorably to Go apps, at least for larger applications. It would probably take something more like CoreRT to get app size to be competitive with Rust and C.

> you can get Hello World down to about 2MB

(sobs woefully)

In contrast, a pure Win32 Hello World (with GUI) can be 2KB or less with only the addition of some non-default linker options.

That's 3 orders of magnitude difference. Obviously it won't be as much with more complex applications, but it's still funny to see others here considering a dozen MB or so for doing something trivial to be small, when that's the size of a full installation of Windows 3.11 complete with all its built-in apps.

You can see here an example of this aggressive reduction in CoreRT https://medium.com/@MStrehovsky/building-a-self-contained-ga...
I think I have tried all the options but could get my app only from 180 to 150MB. It uses WPF. Maybe that’s the problem.