Build and run single C# files from Sublime Text 2 on OSX and Windows.
With any *.cs file open.
Cmd + bCompile filename.cs into filename.exe in current folder and output errorsShift + Cmd + bRun filename.exe in current folder
The aim of this plugin is to provide easy and fast and overhead-free access to the C# language. Without having to load heavy applications such as Visual Studio or Xamarin. This plugin provides a C# sandbox (usable for schools or other learning environments) and is not intended to be used to build production applications.
-
Assumes you have
mcsandmonocommands available in your PATH. For Windows you should havecscin your PATH. If you have previously installed Xamarin Studio or Mono Develop you should have these available in your path. If you don't please read more at here or here -
SublimeFixMacPath (for Mac users) . Required because of updates to Mac OS. Enables Sublime to load your PATH variable.
You can now install the C# build system through the package manager channel. The package is called "C# Compile & Run"
cd ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/git clone git@github.com:ChrOkh/chsharp-build-singlefile-sublime-text-2.git CSharpSinglefile
If you want Visual Studio-style code completion, be sure to also install the awesome plugin CompleteSharp (available via package manager)
Now we can write minimalistic C# console applications:
using System;
class MainClass{
public static void Main(){
Console.WriteLine("Hello world");
}
}