-
July 24th, 2009, 09:21 AM
#1
Running Ruby scripts from C# application
What I am trying to achieve is creating a C# application that wil run several Ruby scripts from a several locations.
In my C# project I have added references to several .dll files (e.g. IronRuby.dll, IronRuby.Libraries.dll, Microsoft.Scripting.dll, etc) in order to execute the ruby scripts.
Location scripts: D:\Projects\Ruby\Test
Location C# app: D:\Projects\VisualStudio\C#\Test
Example RubyScript.rb:
require 'Test'
aTest = Test.new
puts aTest.attr
Code used to call Ruby scripts:
var runtime = Ruby.CreateRunTime();
var engine = runtime.GetEngine();
engine.ExecuteFile("D:\\Projects\\Ruby\\Test\\RubyScript.rb");
Running the application results in the following error message:
- No such file or directory - Test
The application wil run without errors if:
- Ruby scripts do not use require
- The require is defined using absolute paths
- Application is in same directory as the Ruby scripts
I do not like any of these solutions very much. I would like the application to know where to look for the required ruby classes/scripts. Is this possible or do I need to find another solution for my application?
All information on this problem/subject/solution is welcome.
Thanks in advance
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|