cph
cph copied to clipboard
Add support for C#
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#
- Create a .NET project under the workspace folder. The project name will be
.cphcsrun
- Copy the C# source code to
Program.cs
in project folder. - Run
dotnet build
to compile code. - Run binary where located at
<source_name>_bin/.cphcsrun
.
for Mono C#
- Compile the code with
mcs
command. - 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.