问题
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?
回答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.
回答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/
来源:https://stackoverflow.com/questions/398809/is-there-a-port-of-the-rhino-javascript-engine-for-net