7 ms·
Even small utilities in dot net core are ridiculously big and have tens of dll files. Maybe a proper dependency management is needed so that only what parts of
by kyriakos 6y ago
Even small utilities in dot net core are ridiculously big and have tens of dll files. Maybe a proper dependency management is needed so that only what parts of the framework that are actually used are included in the executable.
- giulianob 6y agoTrimming 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.
- Ididntdothis 6y agoHow do you make it more aggressive? Are there options in project file?
- throwaway8941 6y agohttps://docs.microsoft.com/en-us/dotnet/core/whats-new/dotnet-core-3-0#assembly-linking https://docs.microsoft.com/en-us/dotnet/core/whats-new/dotne...
- Ididntdothis 6y agoI 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.
- MarkSweep 6y agoWith 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 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 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.
- throwaway_pdp09 6y ago> you can get Hello World down to about 2MB (sobs woefully)
- userbinator 6y agoIn 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.
- lukyanovic 6y agoYou can see here an example of this aggressive reduction in CoreRT https://medium.com/@MStrehovsky/building-a-self-contained-game-in-c-under-8-kilobytes-74c3cf60ea04 https://medium.com/@MStrehovsky/building-a-self-contained-ga...
- vitorgrs 6y agoI 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.
- BitterAmethyst 6y agoNot every use-case has an always available high-bandwidth internet connection.
- moron4hire 6y agoYeah, 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.
- monadic2 6y agoWhy not statically compile and tree-shake? If this already exists why is it not effective?
- jayd16 6y agoBreaks reflection so I don't think its the most popular way. We're talking about saving how much disk space anyway?
- monadic2 6y agoWhat kind of behavior relies on reflection in C#? Is this widespread or isolatable? Is it necessary to use strings to look up symbols in C# or can you distinguish between strings and identifiers? > We're talking about saving how much disk space anyway? Surely this is relevant to how the customer values disk space, not the developer.
- eropple 6y ago> What kind of behavior relies on reflection in C#? Tons. Serialization, for one, And plugin systems are commonplace. > You have zero grounds to dictate the value of resources. Nonsense and worse words. We know how much disk costs. It is a rounding error for the overwhelming majority of people and the overwhelming majority of apps. Prioritize what matters.
- monadic2 6y ago> Serialization, for one Surely this is doable statically. What is the advantage of doing this at runtime rather than at compile time? > Nonsense and worse words. We know how much disk costs. It is a rounding error for the overwhelming majority of people and the overwhelming majority of apps. Prioritize what matters. Got a citation? Disk space is the only variable that people even know to complain about... Not sure what you're drawing this from but it stinks to high heaven of corporate propaganda.
- 6y ago
- SideburnsOfDoom 6y ago> so that only what parts of the framework that are actually used are included in the executable. This "publishTrimmed=true" is demo'd in this video https://channel9.msdn.com/Events/Build/2020/BOD106 https://channel9.msdn.com/Events/Build/2020/BOD106 Starting around 00:46:30