I would like to know why a .NET Core application is always heavy?
Because when I create a basic hello world application and publish it. Whether in one or more files. The program is at least 20 MB, it's huge. In fact the dependencies (.dll) are very numerous. While a "hello world" only requests a call to the System library (using System;) for example. But lots of libraries are generated so that the application is autonomous.
Actually I'm trying to create a tcp server / client connection but the client is way too heavy (At least 20mo...)
You are presumably building this application in self-contained mode. This means that the entire .NET Core runtime is included in your build output, which is going to add a fixed data size to your build files.
If you don't want to include the .NET Core runtime, then you have to build your application as runtime-dependent. Keep in mind that you can then only run this application in environments where the .NET Core runtime has already been pre-installed.
For reference:
Publishing your app as self-contained produces an application that includes the .NET Core runtime and libraries, and your application and its dependencies. Users of the application can run it on a machine that doesn't have the .NET Core runtime installed.
Publishing your app as runtime-dependent (previously known as framework-dependent) produces an application that includes only your application itself and its dependencies. Users of the application have to separately install the .NET Core runtime.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With