制作:

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. Java基础 - 面向对象 - 类方法传参

    调用方法时可以给该方法传递一个或多个值,传给方法的值叫实参,在方法内部,接收实参的变量叫做形参,形参的声明语法与变量的声明语法一样.形参只在方法内部有效. Java中方法的参数主要有3种,分别为值参数 ...

  2. tpot从elastic search拉攻击数据之一 找本地数据端口

    前面,我们已经在ubuntu服务器上部署好了tpot,并启动进行数据捕获 可以通过64297端口登陆到kibana可视化平台查看捕获到攻击的情况. 现在要拉取攻击数据了,但是该怎么拉呢? 看了一上午的 ...

  3. Django框架视图类

    类视图 在写视图的时候,Django除了使用函数作为视图,也可以使用类作为视图.使用类视图可以使用类的一些特性,比如继承等. View django.views.generic.base.View是主 ...

  4. Linux(8)- nginx+uWSGI+virtualenv+supervisor 发布web服务器

    一.理论梳理 WSGI是web服务器的网关接口,它是一个规范,描述了web服务器(下图中的WEB server)如何与web应用程序(下图中的Application)通信,以及web应用程序如何链接在 ...

  5. centos Docker安装前升级内核3.10的方法

    首先我虚拟机系统都是Centos 6.5 .ESXI ,后安装devel .ESXI 后来 .ESXI 我所操作的都是虚拟机,但是在真实机上面如何我就不清楚了~~ 大家一定要记得安装步骤,,,不然就是 ...

  6. 吴超老师课程--HBASE的Java_API

    public static void main(String[] args) throws IOException { String tableName="hbase_tb"; S ...

  7. Visual Studio2012打不开MVC2.0以及1.0项目如何处理

    /*打开扩展名为csproj的工程文件*/ <ProjectTypeGuids> {F85E285D-A4E0---AB1D724D3325};{349c5851-65df-11da--0 ...

  8. PAT 天梯赛 L1-016. 查验身份证 【水】

    题目链接 https://www.patest.cn/contests/gplt/L1-016 AC代码 #include <iostream> #include <cstdio&g ...

  9. Codeforces Round #396 (Div. 2) D. Mahmoud and a Dictionary

    地址:http://codeforces.com/contest/766/problem/D 题目: D. Mahmoud and a Dictionary time limit per test 4 ...

  10. js实现删除弹框确认

    JSP页面代码如下: <%@ page language="java" contentType="text/html; charset=UTF-8"%&g ...