cph icon indicating copy to clipboard operation
cph copied to clipboard

Add support for C#

Open XezolesS opened this issue 4 months ago • 0 comments

Add support for C#, both .NET and Mono version of it.

Compiling C# is somewhat different than others, so I have to cook it little different. I don't really want to break a codebase, but some methods are added to only handle C#.

The way it works is:

for .NET C#

  1. Create a .NET project under the workspace folder. The project name will be .cphcsrun
  2. Copy the C# source code to Program.cs in project folder.
  3. Run dotnet build to compile code.
  4. Run binary where located at <source_name>_bin/.cphcsrun.

for Mono C#

  1. Compile the code with mcs command.
  2. Run binary with mono command.

It is little bit wanky, but it works.

Also, I fixed an error that failed to delete binary after execution if there's a whitespace in the path in Windows.

I've tested every language but Haskell on Windows 10 and C, C++, C#, Python on Ubuntu 20.04 to make sure I didn't break other compilers.

XezolesS avatar Oct 19 '24 15:10 XezolesS