制作:

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. 开机启动/etc/rc.local失效无效怎么办?解决方法

    开机启动/etc/rc.local失效问题的解决方法 第一种情况:当centOS 随机启动文件 /etc/rc.local 失效时请按如下修改1.echo /etc/rc.local >> ...

  2. Linux基础命令(一)

    一.开启Linux操作系统,要求以root用户登录GNOME图形界面,语言支持选择为汉语没有图形界面 二.使用快捷键切换到虚拟终端2,使用普通用户身份登录,查看系统提示符 Ctrl + Alt + F ...

  3. java输出pdf

    package snake; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; ...

  4. 【Java编程】写入、读取、遍历Properties文件

    在Java开发中通常我们会存储配置參数信息到属性文件.这种属性文件能够是拥有键值对的属性文件,也能够是XML文件.关于XML文件的操作,请參考博文[Java编程]DOM XML Parser 解析.遍 ...

  5. 【Sql Server】—sql Servler登录失败

    登录失败报错信息如下: 标题: 连接到服务器 ------------------------------ 无法连接到 localhost. ----------------------------- ...

  6. 添加github ssh 公钥

    1.在控制台输入命令: ssh-keygen -t rsa -C "github上的邮箱地址" 2.将公匙复制后添加到github网站:    id_rsa.pub文件 3.测试是 ...

  7. 海量数据处理之Bloom Filter详解

    前言 :  即可能误判    不会漏判   一.什么是Bloom Filter     Bloom Filter是一种空间效率很高的随机数据结构,它的原理是,当一个元素被加入集合时,通过K个Hash函 ...

  8. beego——构造查询

    QueryBuilder提供了一个简单.流畅的SQL查询构造器.在不影响代码可读性的前提下用来快速的建立SQL语句. QueryBuilder在功能上与ORM重合,但是个由利弊,ORM更适合用于简单的 ...

  9. 微信小程序组件text

    基础内容text:官方文档 Demo Code var initData = 'this is first line\nthis is second line' var extraLine = []; ...

  10. 关于comparable接口

    参考博客: https://blog.csdn.net/nvd11/article/details/27393445 第一个例子 @Test public void fun1(){ List list ...