Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

xEKx

macrumors newbie
Original poster
Feb 22, 2012
1
0
Hi,
I want to add C# Language to CodeRunner

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

Thanks in advance :)
 

MisterMe

macrumors G4
Jul 17, 2002
10,709
69
USA
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.

In the best case--the one in which you can actually integrate C# with CodeRunner--you will need to download and install Mono.
 

David Sheeks

macrumors newbie
May 20, 2012
1
0
Configure C# on CodeRunner using mono

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):

Code:
file=$1
/usr/bin/mcs "$file"
status=$?
if [ $status -ne 0 ]
then
exit $status
fi
echo $file | sed -e "s/\.cs/.exe/"
exit 0

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

Code:
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.