Compiling C# in Visual Studio?

I get that Unity uses Mono even for it’s Windows builds, probably for consistency. (plus users who don’t have .NET installed couldn’t run it)

But since I’m creating a server and speed is important, would I benefit from compiling my scripts in Visual Studio and using the dll-s in Unity and could I compile MonoBehavior scripts (they handle Unity part) or only the pure C# scriprs (this is the server which runs in it’s own threads) ?

Yes, you can create any .NET libraries (dll) anywhere. Then you put in into Unity project. Then you run it with unity that runs on mono. All you dlls will be interpret by mono.

In fact, you cannot actually compile .net dlls. They will be in MSIL. So when Unity builds windows executables, it creates actual binary codes that can be run only on windows (and without .net).