View Full Version : How to add C# to CodeRunner?

Feb 22, 2012, 09:13 PM
I want to add C# Language to CodeRunner

How to add it could you guys tell me in detail please

Thanks in advance :)

Feb 22, 2012, 11:01 PM
CodeRunner supports AppleScript, C, C++, Java, Objective-C, Perl, PHP, Ruby, and Shell Script. It does not support C#. If you want C# support in CodeRunner, then you should express your desires to CodeRunner's developer, Nikolai Krill.

As you are no doubt know, C# is a part of Microsoft's .NET frameworks. I am not aware of the value of C# outside the .NET frameworks. .NET does not exist on MacOS X. However, there is a clone of the .NET frameworks that should be fairly mature now. It is Mono 2.10.8 (http://www.go-mono.com/mono-downloads/download.html).

In the best case--the one in which you can actually integrate C# with CodeRunner--you will need to download and install Mono (http://www.mono-project.com/Main_Page).

David Sheeks
May 20, 2012, 09:58 AM
Configuring CodeRunner to compile and run C# is actually reasonably simple if you have Mono installed (if not, see http://www.go-mono.com/mono-downloads/download.html). Mono includes command line utilities to compile and run C# programs which by default are:

Compiler: /usr/bin/mcs
Runtime execution: /usr/bin/mono

To configure CodeRunner for C#, open the CodeRunner Preferences dialog, go to the "Languages" tab, click the "+" icon and and specify "C#" as the Language name. On the right you have fields where you can populate the language settings. Check the "Language uses compilation script" check box, enter "/usr/bin/mono $compiler" (no quotes) for the Run Command, set the File Extension to "cs" (again, no quotes). Click the "Edit Script..." button and append the following to the compile.sh script (this will open in the CodeRunner editor):

/usr/bin/mcs "$file"
if [ $status -ne 0 ]
exit $status
echo $file | sed -e "s/\.cs/.exe/"
exit 0

You can specify a code template like the following if desired:

using System;
public class MyProgram {
public static void Main( string[] args ) {
Console.WriteLine( "Hello, World!" );

CodeRunner doesn't have native syntax highlighting support for C#, but you can select Java as the syntax mode and the syntax highlighting works reasonably well since.