Making:
1. Configure the environment variable path
7.0 C:\Program Files (x86) \microsoft Visual Studio\ \enterprise\msbuild\15.0\binc:\program Files (x86) \microsoft Visual Studio\2017 \enterprise\msbuild\15.06.0C:\Program Files (x86) \msbuild\14.0 5.0 C:\Windows\Microsoft.NET\Framework\v4. 0.30319 available According to the registry: Hkey_local_machine\software\microsoft\msbuild
2. Add CSharp Build Configuration
In sublime text, click menu: Tools--build system--New build system ...
Paste:
{ "Shell_cmd":"csc.exe/utf8output/unsafe/out:\ "${file_path}/${file_base_name}.exe\" \ "${file}\"", "File_regex":"^(.. [^:]*]:([0-9]+):? ([0-9]+)?:? (.*)$", "Working_dir":"${file_path}", "selector":"Source.cs", //" encoding": "cp936", "variants": [ { "name":"Build & Run", "Shell_cmd":"csc.exe/utf8output/unsafe/out:\ "${file_path}/${file_base_name}.exe\" \ "${file}\" && start \ "${file_ Base_name}.exe\ "/d \" ${file_path}\ "\" ${file_base_name}.exe\ "", "Working_dir":"${file_path}" }, { "name":"Run", "Shell_cmd":"start \ "${file_base_name}.exe\"/d \ "${file_path}\" \ "${file_base_name}.exe\"", "Working_dir":"${file_path}" }, { "name":"Build (Form)", "Shell_cmd":"Csc.exe/utf8output/unsafe/t:winexe/r:system.windows.forms.dll; System.drawing.dll/out:\ "${file_path}/${file_base_name}.exe\" \ "${file}\"", "Working_dir":"${file_path}" }, { "name":"Build & Run (Form)", "Shell_cmd":"Csc.exe/utf8output/unsafe/t:winexe/r:system.windows.forms.dll; System.drawing.dll/out:\ "${file_path}/${file_base_name}.exe\" \ "${file}\" && start \ "${file_base_name}.exe \ "/d \" ${file_path}\ "\" ${file_base_name}.exe\ "", "Working_dir":"${file_path}" }, { "name":"Run (Form)", "Shell_cmd":"start \ "${file_base_name}.exe\"/d \ "${file_path}\" \ "${file_base_name}.exe\"", "Working_dir":"${file_path}" } ]}
Save As: Csharp.sublime-build
Use:
Edit a CS file and save it. such as Test.cs:
1 usingSystem;2 usingSystem.ComponentModel;3 usingSystem.Windows.Forms;4 usingSystem.Reflection;5 usingSystem.Runtime.CompilerServices;6 7 Static classProgram {8 [STAThread]9 Public Static voidMain (params string[] args) {Ten Test (); One //Console.Write ("\npress any key to EXIT ..."); A //Console.readkey (true); - } - the Static voidTest () { - vars ="?"; - MessageBox.Show (s); - } +}
Press Ctrl+shift+b to select the type of compilation. The above example chooses Build & Run (Form) to see the results.
Press Ctrl+b to compile according to the last compilation type.
Sublime Text C # compilation (Csharp.sublime-build)