更新时间:2023-12-05 13:55:46
您也可以尝试用执行红宝石code IronRuby的的像这样的东西
使用系统;
使用Microsoft.Scripting.Hosting;
使用IronRuby的;
类ExecuteRubyExample
{
静态无效的主要()
{
的ScriptEngine引擎= IronRuby.Ruby.CreateEngine();
engine.ExecuteFile(C:/rubyscript.rb);
}
}
It was answered here calling a ruby script in c#
but does that work? I tried this but it keeps failing with "The system cannot find the file specified" error, I'm assuming its because of ruby command before the file name, but I'm not quite sure.
Thanks for the help
You could also try to execute the Ruby code with IronRuby with something like this
using System;
using Microsoft.Scripting.Hosting;
using IronRuby;
class ExecuteRubyExample
{
static void Main()
{
ScriptEngine engine = IronRuby.Ruby.CreateEngine();
engine.ExecuteFile("C:/rubyscript.rb");
}
}