Search code examples
c#.net-coref#.net-nativecorert

Can .NET Core be used to build native Linux binaries?


Apologies if the question seems basic, but I did some Googling and couldn't find a clear answer (Perhaps I don't know the right keywords).

Can .NET Core be used to build native command-line Linux binaries from C# / F# sources? (I'm aware of Mono)


Solution

  • Yeah, it can. I've messed with it a bit.

    dotnet new console

    ...

    dotnet publish -c release -r linux-x64

    Or something along those lines... It's been a while since I messed with it, but there is help and tutorials out there for doing dotnet on Linux and I've gotten it to work just fine on CentOS 7. Of course, I did this on a Linux machine and not from a Windows machine. If your asking if you can create a console (command-line) app on Windows for Linux with .NET Core, I don't know.