Can any c# application be run on linux

Scavs picture Scavs · Aug 29, 2015 · Viewed 47.4k times · Source

I am developing a game server in c#. Server talks to clients via sockets and sends byte[] using custom packet protocol. The question is, will this software be windows os specific or will be able to run on linux server. I've read different posts on different forums where developers say that their server is windows os only, some say it can run on linux.

Is there any specific factor? Does application have to be written specificly to be able to run on linux?

Answer

BradleyDotNET picture BradleyDotNET · Aug 29, 2015

Update for 2020

.NET Core and .NET Framework are being merged together into ".NET 5". For all intents and purposes, this is just the next version of .NET Core (and .NET Framework is going away).

WPF still only runs on windows (though a universal XAML based UI system is in development), even though its running on .NET Core/5, and you still have to build specifically for Linux for supported project types, but the cross platform support is much better than when I originally wrote this.

Original

For .NET code to be able to run on Linux, you need a version of .NET that is compatible with that platform.

Full .NET is windows-only, but there is the Mono framework which runs on Linux. .NET Core is also being ported to linux.

Neither Mono or .NET Core supports the entirety of standard .NET. For example, neither will let you run a WPF application. So as long as your code is compatible with one of the aforementioned frameworks; yes, you can run it on Linux.

For your specific example, the classes you mention should be supported, and I don't think you'll have any trouble running under either Mono or .NET Core.