IronRuby CreateScriptSourceFromFile can't find file

359 Views Asked by At

I have a very simple program that is meant to call the code in an .rb file from C#, but can't figure out how to properly form a file reference that CreateScriptSourceFromFile will accept. Here is the most current incarnation:

using System;
using System.Collections.Generic;
using System.IO;

using IronRuby;
using Microsoft.Scripting.Hosting;

namespace IronRubyFromCSharp
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                var rubyEngine = Ruby.CreateEngine();
                var searchPaths = new List<String>();
                searchPaths.Add(".");
                searchPaths.Add(@"C:\sbgit\IRFromCS\IronRubyFromCSharp\Ruby\");
                rubyEngine.SetSearchPaths(searchPaths);

                var scriptSource = rubyEngine.CreateScriptSourceFromFile("hello.rb");
                var codeText = scriptSource.GetCode();
                Console.WriteLine(codeText);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
            Console.ReadLine();
        }
    }
}

I have confirmed that the file exists and that it contains valid Ruby code, but every time I execute this, I get a System.NotImplementedException when I try to execute, compile, or even just access the code.

What is the proper way to reference a code file in CreateScriptSourceFromFile?

1

There are 1 best solutions below

2
On

download zip version from http://ironruby.codeplex.com/releases/view/60511#DownloadId=217152

use zip version dll(IronRuby.dll and Microsoft.Scripting.dll)