简体   繁体   English

Mono C#编译器响应文件语法

[英]Mono C# compiler response file syntax

I have a basic foundation in C#, having used it briefly at a previous job. 我在C#中具有基本的基础,在上一份工作中曾简要使用过它。 Right now I'm working on really understanding the language and its paradigms by going through Pro C# 5.0 and the .NET 4.5 Framework . 现在,我正在通过Pro C#5.0和.NET 4.5 Framework来真正理解语言及其范例。 However, my main computing environment is a GNU/Linux system so I'm doing this using Mono. 但是,我的主要计算环境是GNU / Linux系统,因此我使用Mono来实现。

That said I'm running into a problem using the mono C# compiler ( mcs ) to run a build using a response file ( .rsp ). 就是说,我在使用Mono C#编译器( mcs )来运行使用响应文件( .rsp )的构建时遇到了问题。 Where can I find documentation about how mono parses these files and the syntax it expects? 在哪里可以找到有关mono如何解析这些文件及其预期语法的文档?

Mostly I've run into not knowing how to specify a comment (the # symbol which is a comment under the Microsoft implementation seems to be interpreted as a file by mcs), and not knowing how to specify the options themselves. 大多数情况下,我遇到了不知道如何指定注释(mc符号在Microsoft实现下为注释的#符号似乎被mcs解释为文件),并且不知道如何自行指定选项的问题。

# TestApp.rsp
-r:System.Windows.Forms.dll
-target:exe -out:TestApp.exe *.cs

When compiled: 编译时:

$ mcs @TestApp.rsp
error CS2001: Source file `#' could not be found
TestApp.rsp(2,0): error CS1024: Wrong preprocessor directive
TestApp.rsp(2,0): error CS1525: Unexpected symbol `-'
Compilation failed: 3 error(s), 0 warnings

mcs doesn't seem to support comments. mcs似乎不支持评论。 It just loads the response file line-by-line, strips any single or double quoting and processes the line as if it were passed as a command line argument. 它只是逐行加载响应文件,去除所有单引号或双引号,并像对待作为命令行参数一样传递该行。 You can look at the LoadArgs function in mcs source . 您可以在mcs源代码中查看LoadArgs函数 It would be easy to add comments, though, so you might want to submit a patch or pull request. 不过,添加评论很容易,因此您可能要提交补丁或请求请求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM