我试图在mono中的默认控制台项目上使用Saltarelle C# Compiler

using System;

namespace SaltarelleConsoleTest
{
    class MainClass
    {
        public static void Main (string[] args)
        {
            Console.WriteLine ("Hello World!");
        }
    }
}

但是当我试图用终端命令编译它时
mono lib/Saltarelle.Compiler/tools/sc.exe -reference:lib/Saltarelle.Runtime/tools/Assemblies/mscorlib.dll Main.cs -outscript:bin/main.js

出现此错误:
Unhandled Exception: System.TypeLoadException: Could not load type 'Saltarelle.Compiler.Program' from assembly 'sc, Version=1.5.0.0, Culture=neutral, PublicKeyToken=a4048e8fcc593f14'.
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeLoadException: Could not load type 'Saltarelle.Compiler.Program' from assembly 'sc, Version=1.5.0.0, Culture=neutral, PublicKeyToken=a4048e8fcc593f14'.

我做错什么了?是否有人成功地用saltarelle(或任何其他c到javascript编译器,如Script#)设置mono开发?

最佳答案

你必须:
消除ms system.dll引用(并使用system;因此没有console.writeline!)(二)
添加对saltarelle mscorlib.dll和script.web.dll的引用(可选)
指示运行时:
mono--runtime=v4.0.30319 lib/saltarelle.compiler/tools/sc.exe-引用:lib/saltarelle.runtime/tools/assemblies/mscorlib.dll main.cs-outscript:bin/main.js

10-07 22:27