Created
May 18, 2012 04:47
-
-
Save adambyram/2723203 to your computer and use it in GitHub Desktop.
Configuration to support C# (via Mono) for CodeRunner on OSX
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace CodeRunner | |
{ | |
class MainClass | |
{ | |
public static void Main (string[] args) | |
{ | |
Console.WriteLine ("Hello World!"); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
To support C# in CodeRunner: | |
1) Install the Mono runtime | |
2) CodeRunner -> Preferences | |
3) Switch to the Language tab | |
4) Use the "+" to add a "C#" entry | |
5) Check "Language uses compilation script" | |
6) Set the Run Command to "mono $compiler" | |
7) Set the code template to the "C# Template" below | |
8) Set syntax mode to Generic | |
9) Set file extension to "cs" | |
10) Click "Edit Script" | |
11) Paste in the compile.sh file contents below | |
12) Save the updated compile.sh | |
That's it. This is a *very* basic setup. It doesn't handle failure if your code doesn't compile, it doesn't handle adding assembly references, or anything else. If you need any of that, you'll need to update the compile.sh file, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This is a CodeRunner compilation script. Compilation scripts are used to | |
# compile code before being run using the run command specified in CodeRunner | |
# preferences. This script should have the following properties: | |
# | |
# Launch directory ($PWD): Will be the same as the file being run | |
# | |
# Exit status: Should be 0 on success (will cause CodeRunner | |
# to continue and execute the run command) | |
# | |
# Output (stdout): On success, one line of text which can be accessed | |
# using the $compiler variable in the run command | |
# | |
# Output (stderr): Anything outputted here will be displayed in | |
# the CodeRunner console | |
# | |
# Arguments: $1 Filename of the source file | |
# $2 Encoding of the source file | |
# $3 Compilation flags set in CodeRunner preferences | |
# $4 Path of a temporary directory (without / suffix) | |
# | |
# The encoding argument may be used to specify to the compiler which encoding | |
# the source file uses. It will be one of the integers in the following array: | |
enc[4]="UTF8" # UTF-8 | |
enc[10]="UTF16" # UTF-16 | |
enc[5]="ISO8859-1" # ISO Latin 1 | |
enc[9]="ISO8859-2" # ISO Latin 2 | |
enc[30]="MacRoman" # Mac OS Roman | |
enc[12]="CP1252" # Windows Latin 1 | |
enc[3]="EUCJIS" # Japanese (EUC) | |
enc[8]="SJIS" # Japanese (Shift JIS) | |
enc[1]="ASCII" # ASCII | |
file=$1 | |
file=${file/\.cs/\.exe} | |
mcs "$1" | |
echo "$file" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
but not work on yosemite