例如,如果我在 sublime 中的当前文件是 foo.cs,我希望它运行“csc /out:foo.exe foo.cs”。我不想运行完整的 msbuild。
在 Sublime 中,在以下文本中选择菜单 Tools > Build System > New Build System Paste。将其另存为“C#.sublime-build”。
{
"cmd": ["cmd", "/c", "del", "${file/\\.cs/\\.exe/}", "2>NUL", "&&", "csc", "/nologo", "/out:${file/\\.cs/\\.exe/}", "$file"],
"file_regex": "^(...*?)[(]([0-9]*),([0-9]*)[)]",
"variants": [
{ "name": "Run", "cmd": ["cmd", "/c", "start", "cmd", "/c", "${file/\\.cs/\\.exe/}"] }
],
}
Run Code Online (Sandbox Code Playgroud)
或者当你输入 ctrl-b 时,这条替代线会构建并运行它:
"cmd": ["cmd", "/c", "del ${file/\\.cs/\\.exe/} 2>NUL && csc /nologo /out:${file/\\.cs/\\.exe/} $file && start cmd /c ${file/\\.cs/\\.exe/}"],
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4914 次 |
| 最近记录: |