I created a new .NET Core 3.1 console application, and did not modify the code (so it is only a hello world example).
I published the application into a folder with the following settings:
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration>Release</Configuration>
<Platform>Any CPU</Platform>
<PublishDir>bin\Release\netcoreapp3.1\publish\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>netcoreapp3.1</TargetFramework>
<SelfContained>false</SelfContained>
</PropertyGroup>
</Project>
After publishing, it created 5 files. The two interesting ones:
TestApp.dll- 4608 bytesTestApp.exe- 174 592 bytes
(Others are insignificant now: pdb, deps.json, runtimeconfig.json)
As I learned, the DLL file contains all my source code (I checked it with ILSpy as well). But why is the exe file so large? As far as I know, it should be just a wrapper that calls into the framework with the DLL file as entry point.
How can I reduce its size?
I want to make a simple utility application but it seems like the minimum size is 200 KB? That is absurd.