Skip to content

Instantly share code, notes, and snippets.

@chaliy
Created March 18, 2012 21:17
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save chaliy/2081378 to your computer and use it in GitHub Desktop.
Save chaliy/2081378 to your computer and use it in GitHub Desktop.
Sublime Build to compile and run C# program
{
// This build system will build your cs file to exe file and will run it
"cmd": ["del ${file/\\.cs/\\.exe/} 2>NUL", "& csc /nologo /out:${file/\\.cs/\\.exe/} $file", "& ${file/\\.cs/\\.exe/}"],
"file_regex": "^(...*?)[(]([0-9]*),([0-9]*)[)]",
// By default csc is not in your PATH, so add it to your path
// or uncomment "path" and check that it has correct value
//"path": "C:/Windows/Microsoft.NET/Framework64/v4.0.30319/",
"shell": true, // Without this sublime has hard times to parse "&" in out command line
"selector": "source.cs"
}
@Restuta
Copy link

Restuta commented Mar 19, 2012

awesome, thanks

@SgtPooki
Copy link

Breaks when path includes spaces, and I can't get mine to work either..

{
"working_dir" : ["$file_path"],
"cmd": ["csc", "/out:$file_base_name.exe", "$file", "& $file_base_name.exe"],
"shell" : true,
"selector" : "source.cs"
}

no errors, but no output either.

@Keep3r
Copy link

Keep3r commented Mar 4, 2018

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment