Reputation: 45
I tried to use the Saltarelle C# Compiler on a default Console Project in Mono
using System;
namespace SaltarelleConsoleTest
{
class MainClass
{
public static void Main (string[] args)
{
Console.WriteLine ("Hello World!");
}
}
}
but when I try to compile it with the terminal command
mono lib/Saltarelle.Compiler/tools/sc.exe -reference:lib/Saltarelle.Runtime/tools/Assemblies/mscorlib.dll Main.cs -outscript:bin/main.js
this error occurs:
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'.
What I am doing wrong? Has anyone successfully set up Mono-Develop with Saltarelle (or any other C# to Javascript Compiler like Script#)
Upvotes: 2
Views: 1045
Reputation: 16
you must:
mono --runtime=v4.0.30319 lib/Saltarelle.Compiler/tools/sc.exe -reference:lib/Saltarelle.Runtime/tools/Assemblies/mscorlib.dll Main.cs -outscript:bin/main.js
Upvotes: 0
Reputation: 1183
I tried your example and it produces the following:
Main.cs(9,13): error CS0103: The name `Console' does not exist in the current context
which is correct considering that Saltarelle's System
namespace does not have a Console
type. I don't know why it gives you the unhandled exception, what version are you using?
Saltarelle is an external compiler which does not depend on Mono or Visual Studio, although you can configure your IDE to call it when compiling your project.
Upvotes: 1