5 ms·
> And you end up with a console app that is 20-100MB What are you talking about? It's 1.4MB. This is the easiest thing in the world to verify: $ dotnet p
by lol768 6y ago
> And you end up with a console app that is 20-100MB
What are you talking about? It's 1.4MB.
This is the easiest thing in the world to verify:
$ dotnet publish -c Release
Microsoft (R) Build Engine version 16.8.3+39993bd9d for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
Determining projects to restore...
All projects are up-to-date for restore.
ConsoleApp -> /tmp/ConsoleApp/bin/Release/net5.0/ConsoleApp.dll
ConsoleApp -> /tmp/ConsoleApp/bin/Release/net5.0/publish/
$ cd /tmp/ConsoleApp/bin/Release/net5.0/publish/
$ du -h
1.4M .
And no, I don't want to hear about any figures for self-contained builds. It's an article about useful packages to help architecture your .NET console app. It's to be read in that context, where the .NET 5 runtime is available.
- erikbye 6y ago> And no, I don't want to hear about any figures for self-contained builds. Then what is your point? When talking about the size required for a program to run, you have to weigh all of its dependencies. For anyone interested, such a binary ends up at least 50MB, if we include the dependencies mentioned in the article in question.
- lol768 6y ago> For anyone interested, such a binary ends up at least 50MB .. if you don't make any use of assembly optimisation/trimming, sure. $ dotnet publish -c Release Microsoft (R) Build Engine version 16.8.3+39993bd9d for .NET Copyright (C) Microsoft Corporation. All rights reserved. Determining projects to restore... Restored /tmp/ConsoleApp/ConsoleApp.csproj (in 18.97 sec). ConsoleApp -> /tmp/ConsoleApp/bin/Release/net5.0/linux-x64/ConsoleApp.dll Optimizing assemblies for size, which may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink ConsoleApp -> /tmp/ConsoleApp/bin/Release/net5.0/linux-x64/publish/ $ cd /tmp/ConsoleApp/bin/Release/net5.0/linux-x64/publish/ $ ls total 29M > When talking about the size required for a program to run, you have to weigh all of its dependencies. Except the dependencies might not even be relevant depending on which OS you're targeting - and in the context of this article, why is this even interesting? You can make all of the same criticisms of the JVM, or .NET web apps or anything else - do you statically link libc?
- deleted 6y ago[deleted]
- loic-sharma 6y agoJust to be clear, a self-contained build includes the .NET runtime and all its libraries in your build output. Most people just install .NET on their machines. If so, that 1.4mb executable will run just fine.
- wtetzner 6y agoThe .NET framework is usually expected to be installed at the system level. And to what extreme do you take that line of thought? Should the kernel size be included?
- tester756 6y agoin my opinion it is not the greatest argument You write: >And you end up with a console app that is 20-100MB. Yea, but you can also say >And you end up with a decent size app that is 20-100MB. and also you can say >And you end up with a decent size app that is 2MB because you already have runtime, because you use .NET apps.
- kcartlidge 6y agoYou may well be right for Windows. However, many command line tools need to be cross-platform, and in that situation (especially on Linux) the .NET framework/runtime very likely won't be installed. Unless you are only doing Windows tooling, you probably do need to bear that in mind.