3 ms·
Yes, it can contain the .NET runtime like a Go executable. You can already (mostly) do this today with .NET Core 3/3.1 (I say "mostly" just because it simply u
by mdasen 6y ago
Yes, it can contain the .NET runtime like a Go executable. You can already (mostly) do this today with .NET Core 3/3.1 (I say "mostly" just because it simply unzips the runtime on first run). I deploy to Linux with everything in a single file and it's been perfect - headache-less deploys. You can read more at https://github.com/dotnet/designs/blob/master/accepted/2020/single-file/design_3_0.md https://github.com/dotnet/designs/blob/master/accepted/2020/... and https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-publish https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-pu.... I haven't had any problems with it at all. The size is a bit bigger, but I don't really care about that and then I can just run it like anything else without worrying about making sure that the .NET runtime is on my deploy system and kept up to date.
You can also use the PublishReadyToRun flag to do AOT compilation so that startup times are faster (https://docs.microsoft.com/en-us/dotnet/core/whats-new/dotnet-core-3-0#readytorun-images https://docs.microsoft.com/en-us/dotnet/core/whats-new/dotne...). It still keeps the IL (intermediate language) around for certain things so the file sizes can be a bit larger, but if startup times are a concern, it's an option.
- cm2187 6y agoI wish there was an intermediary solution, where it wouldn't ship the runtime but would still be single file. The full .net framework had ILMerge that was doing exactly that. But it isn't compatible with .net core.
- shawnz 6y agoIt seems like you can set PublishSingleFile true with self-contained false, isn't that what you want?
- cm2187 6y agoIf we can do that (and don't pay a sluggish start up time as some mentioned we currently do) then yes, absolutely. It doesn't bloat the executable with binaries that are already installed on the machine, and the executable benefits from future updates to the framework.