对于Windows考虑an approach to doing what you want on the Sublime Text forums。虽然它是针对ST2发布的,但我发现它在ST3中也能正常工作。
我认为在阅读构建系统文档后,您会发现海报的特定方法更容易遵循和适应,而不是试图从头开始获得解决方案。
这里是.sublime-build
文件的内容 - 与1))的cmd
路径为我的Windows环境和2设置$file
通过*.cs
取代编译当前文件的目录中的所有.cs
文件:
{
"cmd": ["C:\\Bin\\Scripts\\sublimetext_csharp_builder.bat", "*.cs", "${file/\\.cs/\\.exe/}"], // NOTE: path set for my Windows environment
//"cmd": ["\\path\\to\\sublimetext_csharp_builder.bat", "$file", "${file/\\.cs/\\.exe/}"],
"working_dir": "${project_path:${folder:${file_path}}}",
"file_regex": "^(...*?)[(]([0-9]*),([0-9]*)[)]",
"selector": "source.cs"
}
你可以找到the related sublimetext_csharp_builter.bat
file on GitHub。下面我只是1)删除了它依赖于Visual Studio批处理文件来设置环境变量,这确实没有必要,只要csc
在%PATH%
中解决,或者使用它的完整路径和2)引用其中的路径产生exe
,我认为有必要为我所用的路径(因为它包含空格):
:: Assumptions:
:: - Sublime Text has set the working directory and both the source and executable files
:: are in that directory
:: - The script is only capable of handling simple C# apps that do not reference 3rd-party
:: libraries
:: Inputs from Sublime Text
:: %1 - The full path and filename of the source file to build
:: %2 - The name of the executable file
@SET SRC_FILE="%1"
@SET EXE_NAME="%2"
csc %SRC_FILE% /nologo /debug:full /platform:x86
@IF errorlevel 1 GOTO end
:: Execute compiled binary if build was successful.
@ECHO.
@ECHO Executing %EXE_NAME%:
@ECHO.
:: NOTE: path quoted to accommodate spaces in it
@"%EXE_NAME%"
@%EXE_NAME%
:end
是你的问题如何编译与中信建投单呼或别的东西(“CSC /多个CS文件?“应该帮助前者 - 只需指定所有文件)... –
@AlexeiLevenkov是的,我想要执行相同的'gmcs * .cs; mono * .exe',它可以在bash脚本中成功运行,但不是运行脚本,而是将它放在'.build-system'文件中,它应该是这样(但我不知道如何) 。 – heltonbiker
我明白了 - 你的问题是关于我不知道的事情,所以我为什么不理解它。抱歉。 –