我刚开始使用CoreCRL进行测试。我可以编译并运行HelloWorld.cs示例。但是当我添加一些额外的功能来实现它时,这是我的代码:
using System;
namespace BenchMark
{
class Program
{
/*******************************************************************************/
public static void Main()
{
try
{
Console.WriteLine("BenchMark.exe C# runned");
string[] param = System.Environment.GetCommandLineArgs();
var benchMarkType = param[1];
switch (benchMarkType)
{
case "alg":
PhepToanDaiSo p = new PhepToanDaiSo();
p.callAlg(param);
break;
case "method":
ThuatToanBiz.callMethod(param);
break;
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
/*************************************************/
}
}
所有的类和调用都是有效的,我可以成功运行该程序。但是当我尝试编译它时使用CoreCLR,语法为:
E:\Learning\Viegrid\Native\SVN\trunk\BenchMark\BenchMark>csc /nostdlib /noconfig /r:packages\System.Runtime.4.0.20-beta-22703\lib\contract\System.Runtime.dll /r:packages\System.Console.4.0.0-beta-22703\lib\contract\System.Console.dll /out:runtime\BenchMark.exe Program.cs
Microsoft(R)Visual C#编译器版本4.6.1055.0 for C#5版权所有 (C)Microsoft Corporation。保留所有权利。
我收到了错误:
Program.cs(13,41): error CS0234: The type or namespace name 'Environment' does not exist in the namespace 'System' (are
you missing an assembly reference?)
Program.cs(18,25): error CS0246: The type or namespace name 'PhepToanDaiSo' could not be found (are you missing a using
directive or an assembly reference?)
Program.cs(18,47): error CS0246: The type or namespace name 'PhepToanDaiSo' could not be found (are you missing a using
directive or an assembly reference?)
Program.cs(22,25): error CS0103: The name 'ThuatToanBiz' does not exist in the current context
我做错了什么?或者coreclr只能用于除“System”之外的任何命名空间?