gpt4 book ai didi

c# - 如何为 Sublime 3 创建构建系统来编译当前的 cs 文件? (C#)

转载 作者:太空宇宙 更新时间:2023-11-03 21:16:26 24 4
gpt4 key购买 nike

例如,如果我当前在 sublime 中的文件是 foo.cs,我希望它运行“csc/out:foo.exe foo.cs”。我不想运行完整的 msbuild。

最佳答案

在 Sublime 中,选择菜单 Tools > Build System > New Build System粘贴以下文本。将其保存为“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/}"] }
],
}

或者当你输入 ctrl-b 时,这个替代行会构建并运行它:

"cmd": ["cmd", "/c", "del ${file/\\.cs/\\.exe/} 2>NUL && csc /nologo /out:${file/\\.cs/\\.exe/} $file && start cmd /c ${file/\\.cs/\\.exe/}"],

关于c# - 如何为 Sublime 3 创建构建系统来编译当前的 cs 文件? (C#),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33906312/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com