制作:

1. 配置环境变量PATH

C# 7.0
C:\Program Files (x86)\Microsoft Visual Studio\\Enterprise\MSBuild\15.0\Bin
C:\Program Files (x86)\Microsoft Visual Studio\\Enterprise\MSBuild\15.0\Bin\Roslyn
C# 6.0
C:\Program Files (x86)\MSBuild\14.0\Bin
C# 5.0
C:\Windows\Microsoft.NET\Framework\v4.0.30319
可根据注册表获得:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild

2. 添加CSharp Build配置

在Sublime Text中点击菜单: Tools -> Build System -> New Build System...

粘贴:

{
"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}"
}
]
}

保存为:csharp.sublime-build

使用:

编辑一个cs文件,保存。比如test.cs:

 using System;
using System.ComponentModel;
using System.Windows.Forms;
using System.Reflection;
using System.Runtime.CompilerServices; static class Program {
[STAThread]
public static void Main(params string[] args){
Test();
//Console.Write("\nPress any key to EXIT...");
//Console.ReadKey(true);
} static void Test() {
var s = "ᵏ";
MessageBox.Show(s);
}
}

按Ctrl+Shift+B,选择编译的类型。上面的例子选择 Build & Run (Form) ,就能看见结果。

按Ctrl+B,是按上次的编译类型进行编译。

Sublime Text C# 编译(csharp.sublime-build)的更多相关文章

  1. Sublime Text 3编译Sass - Sublime Text安装Sass插件

    1.首先要安装sass,安装流程: http://www.w3cplus.com/sassguide/install.html 2.sublime text安装Package Control(已经安装 ...

  2. Sublime Text Version 3.2.1(Build 3207)注册

    Sublime Text Version 3.2.1, Build 3207 一. host添加地址 C:\Windows\System32\drivers\etc\hosts 127.0.0.1 l ...

  3. Sublime Text 编辑器 插件 之 "Sublime Alignment" 详解

    作者:shede333主页:http://my.oschina.net/shede333版权声明:原创文章,版权声明:自由转载-非商用-非衍生-保持署名 | [Creative Commons BY- ...

  4. 让你的sublime text写C代码 (sublime text 2 配置构建C开发环境)

    原则 1. 首先你要配置能够编译C++/C环境 2. window中配置该执行环境的环境变量,能够全局使用 3. sublime Text创建新的构建机制.并设置用改全局编译环境 具体过程 能够编译C ...

  5. sublime text配置编译C#环境

    参照:http://www.cnblogs.com/Bob-wei/p/4670341.html 添加C#支持(Windows)  1) 配置环境变量 Path     C# 6.0编译器:可以将cs ...

  6. Sublime Text 2编译python时出错

    [Error 2] The system cannot find the file specified [Finished]   解决方法: 1.环境变量path添加: C:\Python32\Too ...

  7. Ubuntu 13.04 用Sublime Text 2 编译运行 JAVA

    将下面的代码粘贴到JavaC.sublime-build中: { "cmd": ["javac \"$file_name\" && j ...

  8. [Sublime Text] How to Install Sublime Text on Ubuntu

    For Sublime-Text-2: sudo add-apt-repository ppa:webupd8team/sublime-text- sudo apt-get update sudo a ...

  9. Scala Sublime text 3 Build 编译

    使用Sublime text 3编译Scala 在sublime工具栏中[tools]->[Build System]->[new Build System]添加如下文本 { " ...

随机推荐

  1. .net 存储过程中的 output参数取值问题

    当存储过程中多个结果需要返回时经常需要用到output类型的参数,如果存储过程没有返回结果集只是输出output类型参数时使用如下代码: db.AddOutParameter(dbCmd, " ...

  2. 安卓使用Canvas绘制工作日程表

    有一个项目要使用工作表,选择使用canvas来绘制.实现显示工作日程的选择,可点击加入和取消,效果图:http://jwzhangjie.com/workplan.gif 自己定义控件FormView ...

  3. 关于source insight、添加.s和.S文件,显示全部路径、加入项目后闪屏幕

    1.source insight使用也有一年多时间了,今天出现建工程后添加文件“no files found” 百思不得姐: 后面发现是原工程命名时出现非法字符.重新命名就ok了. 切记切记 2.实用 ...

  4. SQL JOIN使用方法

    (转自W3School相关教程:http://www.w3school.com.cn,W3School是不错的在线教程,简洁高效!) 下面列出不同的SQL JOIN类型,以及他们之间的差异: JOIN ...

  5. 吴超老师课程--Pig的介绍和安装

    1.Pig是基于hadoop的一个数据处理的框架.  MapReduce是使用java进行开发的,Pig有一套自己的数据处理语言,Pig的数据处理过程要转化为MR来运行. 2.Pig的数据处理语言是数 ...

  6. CSS 之怀疑自己的审美 1 (Day49)

    CSS概述 CSS是Cascading Style Sheets的简称,中文称为层叠样式表,用来控制网页数据的表现,可以使网页的表现与数据内容分离. 一.css的四种引入方式 1.行内式 行内式是在标 ...

  7. [翻译]Feedback on the Go Challenge solutions

    第一次Go Challenge比赛,中国区只有3人参赛. 赛后收到邮件,是一个审阅者的反馈,“Feedback on the Go Challenge solutions”,摘录如下: 保持简单粗暴 ...

  8. HDU 6356 Glad You Came 2018 Multi-University Training Contest 5 (线段树)

    题目中没有明说会爆int和longlong 的精度,但是在RNG函数中不用unsigned int 会报精度,导致队友debug了很久... 根据每次生成的l,r,v对区间更新m次,然后求 i*ai的 ...

  9. javaEE中的spring配置笔记

    0 JavaEE的工程目录 0.1 WebContent     项目的主目录,在eclipse新建工程时可以自己命名,部署时会把该文件夹的内容发布到tomcat的webapps里. 该目录下可以建立 ...

  10. LVS原理详解以及部署

    linux virtual server简称LVS,Internet的快速增长使多媒体网络服务器面对的访问数量快速增加,服务器需要具备提供大量并发访问服务的能力,因此对于大负载的服务器来讲, CPU. ...