制作:

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. 利用python实现TCP和UDP服务器

    利用python的socket模块可以实现基本的网络编程,并且只限于一对一的连接.当然,也可以在其基础上实现一个网络服务器,但由于太底层这种做法不被推荐.其实如果要实现一个网络服务器很简单,调用pyt ...

  2. ArcGIS api for silverlight 禁用默认浏览操作

    ArcGIS api for silverlight 的mapcontrol中提供了一系列的默认浏览工具选项(default navigation options),如下表所示, 那么如何禁用这些默认 ...

  3. 模块 - hashlib/subprocess

    hashlib 模块 加密算法: hash (152位)散列 哈希 不可逆得 密码背后就是 hash 程序退出hash 值就变了 ,hash值得结果有可能重复 MD5 (128位) 讯息摘要演算法 基 ...

  4. 文件下载(StreamingHttpResponse流式输出)

    文件下载(StreamingHttpResponse流式输出) HttpResponse会直接使用迭代器对象,将迭代器对象的内容存储成字符串,然后返回给客户端,同时释放内存.可以当文件变大看出这是一个 ...

  5. Django限制请求method

    1.常用的请求method 1.1 GET请求: GET请求一般用来向服务器索取数据,但不会向服务器提交数据,不会对服务器的状态进行更改.比如向服务器获取某篇文章的详情. 1.2 POST请求: PO ...

  6. 我的Android进阶之旅------>Android通用流行框架大全

    Android通用流行框架大全 缓存 图片加载 图片处理 网络请求 网络解析 数据库 依赖注入 图表 后台处理 事件总线 响应式编程 Log框架 测试框架 调试框架 性能优化 本文转载于lavor的博 ...

  7. 从库函数解析STM32地址映射

    STM32的存储映射是靠基地址和地址偏移实现的. 32位的M3有4GB的寻址空间,其中用于片上外设的有512MB,基地址为0x40000000. M3各外设基地址,包括片上外设.片上静态RAM和FLA ...

  8. 解决Object() takes on paramenters的问题

    先贴上今天的代码: 解决:是由于父类中的_init_()写成了_int_(),由于粗心导致,下次注意.

  9. virtualenv使用

    virtualenv安装不同版本的python 来自为知笔记(Wiz)

  10. 按钮js跳转到非表单提交页

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...