3

I worked for a company that had both Java and .NET implementations of an application. The app allowed for end-user customization of processing and business rules using scripts. The Java version supported JavaScript using the Rhino engine. The .NET app required VBScript. I would like to do something similar using .NET, but I would prefer to use JavaScript. I have searched but I am having a hard time finding anything like Rhino that will work within the .NET runtime. Do any of you know of or have experience using a JavaScript engine in .NET?

Andrew Van Slaars
  • 1,816
  • 1
  • 14
  • 20
  • See also: http://stackoverflow.com/questions/3926788/javascript-engine-with-good-interoperability-with-jvm-and-clr – A R Jun 16 '12 at 00:18
  • Bit late, but see also http://stackoverflow.com/questions/4744105/parse-and-execute-js-by-c-sharp – Simon Mourier Feb 02 '13 at 18:54

2 Answers2

2

You can use Rhino on .NET with IKVM.NET. I did it once it was very simple; you download the jar files and you generate dlls using IKVM.NET. Then you reference the dlls as usual.

You should check Iron JS. It is a fully .NET solution running on the DLR.

V8 should work ok as well: http://javascriptdotnet.codeplex.com/

Jeno Laszlo
  • 2,023
  • 18
  • 36
1

You should probably use JScript - Microsoft's implementation of JavaScript, which is a full .NET language.

EDIT: it turns out the question is a duplicate. Some specific suggestions: use Managed JScript, or use MSScriptControl.ScriptControlClass in JScript mode.

Community
  • 1
  • 1
orip
  • 73,323
  • 21
  • 116
  • 148
  • What would I use to interpret the JScript? I'm looking for a .NET library that could take the script and interpret it on the server to allow end-user scripting capabilities. – Andrew Van Slaars Dec 30 '08 at 22:29
  • @Andrew: I linked to a previous question (with answers) and to some specific possible solutions. – orip Dec 31 '08 at 08:49