When you create an engine, it doesn't get the ScriptSetup that goes with it. If 
you include the xml elements from ir.exe.config into your apps config, it 
should get the right stuff.

JD

-----Original Message-----
From: ironruby-core-boun...@rubyforge.org 
[mailto:ironruby-core-boun...@rubyforge.org] On Behalf Of Mohammad Azam
Sent: Thursday, January 14, 2010 1:47 PM
To: ironruby-core@rubyforge.org
Subject: Re: [Ironruby-core] Executing irake from C#

This works if I create a ruby file and execute it like this:

ir something.rb

but it does not work using the following code:

  static void Main(string[] args)
        {
            var script = @"require 'rubygems'
require 'rake'

require 'rakefile';

Rake::Task['foo'].execute";

            var engine = IronRuby.Ruby.CreateEngine();
            engine.Execute(script);

        }

Exception is:


Unhandled Exception: IronRuby.Builtins.LoadError: no such file to load 
-- rubyge
ms
   at 
Microsoft.Scripting.Interpreter.ThrowInstruction.Run(InterpretedFrame 
fram
e)
   at 
Microsoft.Scripting.Interpreter.Interpreter.RunInstructions(InterpretedFra
me frame)
   at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame 
frame)
   at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 
arg0, T1 a
rg1)
   at IronRuby.Runtime.RubyScriptCode.Run(Scope scope, Boolean 
bindGlobals)
   at IronRuby.Runtime.RubyScriptCode.Run()
   at Microsoft.Scripting.SourceUnit.Execute()
   at Microsoft.Scripting.Hosting.ScriptSource.Execute()
   at Microsoft.Scripting.Hosting.ScriptEngine.Execute(String 
expression)
   at ConsoleApplication2.Program.Main(String[] args) in 
C:\Projects\EStudyVS200
8\EStudySoltution\EStudy\ConsoleApplication2\Program.cs:line 20
Press any key to continue . . .
-- 
Posted via http://www.ruby-forum.com/.
_______________________________________________
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core

_______________________________________________
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core

Reply via email to