此代码在if(false)语句中使用2.10.8 dmcs以及MonoTouch导致内部编译器错误.这知道吗?(这可能是一个错误报告,但我可能会做一些蹩脚的事情.)
using System;
using System.Collections;
class X
{
static int Main()
{
foreach(var i in GetAll())
{
}
return 0;
}
static IEnumerable GetAll()
{
yield return 1;
if (false)
yield return 2;
}
}
Run Code Online (Sandbox Code Playgroud) 我test.cs
使用dmcs
Mac 的可执行文件和以下命令行程序编译了文件(引用第三方库):
dmcs /out:program.exe test.cs /target:exe /reference:/Users/kevin/path/to/bin/Debug/project.dll
Run Code Online (Sandbox Code Playgroud)
编译没有问题(排除/ reference参数导致问题).这program.exe
在当前目录中创建了一个可执行文件.当我试图像这样运行它:
mono program.exe
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
Unhandled Exception:
System.IO.FileNotFoundException: Could not load file or assembly 'project, Version=3.4.1.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
Run Code Online (Sandbox Code Playgroud)
我能解决这个问题的唯一方法是将project.dll
文件复制到包含该program.exe
文件的目录中.复制project.dll
到同一目录后,程序运行正常.
我可以传递一个额外的参数mono
来指定不同程序目录中的DLL吗?或者,是否有一个标志我可以传递给dmcs
它来直接将DLL编译成二进制文件?
所以,我正在阅读有关mono c#编译器的内容.我知道应用程序的用途是什么,但我只是想知道缩写代表什么.(gmcs,smcs和csc代表什么?)
如果我猜测它将是(Something)Mono Compiler Service.