3 ms·
This has been solved since .NET 6/7 and the results should pleasantly surprise you: - https://learn.microsoft.com/en-us/dotnet/core/deploying/single-file/overv
by neonsunset 2y ago
This has been solved since .NET 6/7 and the results should pleasantly surprise you:
- https://learn.microsoft.com/en-us/dotnet/core/deploying/single-file/overview https://learn.microsoft.com/en-us/dotnet/core/deploying/sing...
- https://learn.microsoft.com/en-us/dotnet/core/deploying/trimming/trim-self-contained https://learn.microsoft.com/en-us/dotnet/core/deploying/trim...
Alternatively, you could try the following first (use .NET 8 SDK):
dotnet publish -o out -p:PublishSingleFile=true -p:PublishTrimmed=true
Also, I just tried worker template (it includes generic host, DI, logger, etc.) and it's only 5 MiB when AOT compiled on macOS:
dotnet new worker --aot
dotnet publish -o out
Will likely take less on Windows and Linux.