3 ms·
Wait, wait… .Net can build “static linked” executables that doesn’t require that I install .Net to run? I had no idea, I guess it’s time to revisit .Net
by mrweasel 5y ago
Wait, wait… .Net can build “static linked” executables that doesn’t require that I install .Net to run? I had no idea, I guess it’s time to revisit .Net
- abdusco 5y agoThat's exactly what it is. You can even cross-compile for all supported platforms. $ dotnet new console -n HelloWorld $ dotnet publish --project HelloWorld -r osx-arm64 --self-contained -o out -p:PublishTrimmed=true $ du -sh out 10M
- qwertox 5y agoWow... I didn't know. Since when can it do this?
- chunkyks 5y agoI've been using this for at least a year or two. With their stripping, my binaries (which use very little other than system.* and math.*) are 12M in size on each OS. I tested with today's release of version six, the binaries are about 1M smaller each.
- tester756 5y agoI believe it was introduced around .NET Core 5? or 3? so at least 1 year ago
- metaltyphoon 5y agoSince .net core 3.0
- the_arun 5y agoI haven't used .net. But how memory management happens when you are running a binary executable? Does it have a builtin CLR (Common Language Runtime[1])? Because CLR provides the tools for managing memory & security? [1] https://en.wikipedia.org/wiki/Common_Language_Runtime https://en.wikipedia.org/wiki/Common_Language_Runtime
- sitharus 5y agoYes, it embeds the CLR in to the application see the PR at https://github.com/dotnet/runtime/issues/43072 https://github.com/dotnet/runtime/issues/43072
- jug 5y agoThis, combined with linker stripping below even assembly level for smaller static binaries. .NET 7 will work on NativeAOT for instantaneous startup of especially smaller apps, but I think they’ve already optimized JIT warmups or something — I was pleasantly surprised when I just wrote a .NET 6 console app that read JSON from a server.
- Anon4Now 5y agoAfter almost 18 years, Joel finally got his wish: https://www.joelonsoftware.com/2004/01/28/please-sir-may-i-have-a-linker/ https://www.joelonsoftware.com/2004/01/28/please-sir-may-i-h...
- JohnTHaller 5y agoIf it's like v5, you can. They're big (since they include .NET, though it looks like v6 will strip out more than v5). And they won't run on Windows 7 without an administrator installing a system component first.