sublime text配置编译C#环境

参照:http://www.cnblogs.com/Bob-wei/p/4670341.html

 添加C#支持(Windows)
  1) 配置环境变量 Path
     C# 6.0编译器:可以将csc.exe所在位置 C:\Program Files (x86)\MSBuild\14.0\Bin 添加到Path环境变量
   C# 5.0编译器:仍然在原来的位置 C:\Windows\Microsoft.NET\Framework\v4.0.30319 或者 C:\Windows\Microsoft.NET\Framework64\v4.0.30319 

  2)添加 CSharp Build 配置

   

{
    "shell_cmd": "csc /out:\"${file_path}/${file_base_name}.exe\" \"${file}\"",
    "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
    "working_dir": "${file_path}",
    "selector": "source.cs",
    "variants":
        [
            {
                "name": "Build & Run",
                "shell_cmd": "csc /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 /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 /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}"
            },
        ]
}

另存为utf8格式的,保存为csharp.sublime-build

 3)然后编辑.cs文件,就可以按Ctrl+Shift+B(Tools -> Build With...),选择编译方法,按Ctrl+B(Tools -> Build)进行编译了

posted @ 2017-08-01 16:51  小羽信息  阅读(666)  评论(0编辑  收藏  举报