Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Right, I don't really keep up with the latest changes – generally running Java/C# has been a bit of a hassle, similar to Python or Ruby. e.g. I had to manually download .NET things from the Microsoft website, and keep my DOTNETHOME directory around as a runtime dependency, etc. Nothing like "just download this binary and that's all you need".

Related from a few days ago: https://news.ycombinator.com/item?id=37701769



This shouldn't be the case for .NET. You only have to download the tooling to build it (which can usually be done through package manager of your choice).

To run the built binaries, whether to require the runtime (by not including it in the executable) or not is a choice.

Tl;Dr of MSFT docs is:

    JIT (w/ Runtime): dotnet publish -c release -p:PublishSingleFile=true -p:PublishTrimmed=true
    JIT (w/o Runtime): dotnet publish -c release -p:PublishSingleFile=true --self-contained false
    AOT: dotnet publish -c release -p:PublishAot=true
These can be configured via .csproj properties too, there are multiple ways to set those depending on your needs. If you don't have any specific dynamically linked native dependencies included with your project, all of the options will be a single executable that you can just run. Do note that to use AOT on macOS you will need .NET 8 (right now it's RC1/preview).

In general, dotnet CLI commands are similar cargo (it had some of the features earlier, some later): dotnet new, build, add, publish, etc.


Right; to be honest I'm not a C# expert, I just did some stuff with RimWorld modding a while back, and when I did that I had to keep all that around for some tooling (specifically: ilspycmd) or it didn't work, but looks like I just couldn't figure it out. Checking my notes I used "dotnet tool install ilspycmd -g" with .NET 6 for this, but looks like I should have used "publish".

I've saved your comment here to look at if I go back to this in the future; thanks!




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: