Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 644535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T21:24:13+00:00 2026-05-13T21:24:13+00:00

IronRuby and VS2010 noob question: I’m trying to do a spike to test the

  • 0

IronRuby and VS2010 noob question:

I’m trying to do a spike to test the feasibility of interop between a C# project and an existing RubyGem rather than re-invent that particular wheel in .net. I’ve downloaded and installed IronRuby and the RubyGems package, as well as the gem I’d ultimately like to use.

Running .rb files or working in the iirb Ruby console is without problems. I can load the both the RubyGems package, and the gem itself and use it, so, at least for that use case, my environment is set up correctly.

However, when I try to do the same sort of thing from within a C# (4.0) console app, it complains about the very first line:

require 'RubyGems'

With the error:

 no such file to load -- rubygems

My Console app looks like this:

using System;
using IronRuby;
namespace RubyInteropSpike
{
    class Program
    {
        static void Main(string[] args)
        {
            var runtime = Ruby.CreateRuntime();

            var scope = runtime.ExecuteFile("test.rb");
            Console.ReadKey();
        }
    }
}

Removing the dependencies and just doing some basic self-contained Ruby stuff works fine, but including any kind of ‘requires’ statement seems to cause it to fail.

I’m hoping that I just need to pass some additional information (paths, etc) to the ruby runtime when I create it, and really hoping that this isn’t some kind of limitation, because that would make me sad.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T21:24:13+00:00Added an answer on May 13, 2026 at 9:24 pm

    Short answer: Yes, this will work how you want it to.
    You need to use the engine’s SetSearchPaths method to do what you wish.

    A more complete example
    (Assumes you loaded your IronRuby to C:\IronRubyRC2 as the root install dir)

        var engine = IronRuby.Ruby.CreateEngine();
    
        engine.SetSearchPaths(new[] {
            @"C:\IronRubyRC2\Lib\ironruby",
            @"C:\IronRubyRC2\Lib\ruby\1.8",
            @"C:\IronRubyRC2\Lib\ruby\site_ruby\1.8"
        });
    
        engine.Execute("require 'rubygems'"); // without SetSearchPaths, you get a LoadError
        /*
        engine.Execute("require 'restclient'"); // install through igem, then check with igem list
        engine.Execute("puts RestClient.get('http://localhost/').body");
        */
        Console.ReadKey();
    

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just installed IronRuby 1.1. I'm trying to take a look at rake and albacore.
So I've been trying to get Watir setup with Ironruby so I can use
While I know IronRuby isn't quite ready for the world to use it, I
Is it currently possible with pre release of ironruby to run rubygems? It seems
Is it possible to call managed code, specifically IronRuby or IronPython from unamanaged code
Which IDE if any, are people using to develop Ironruby in?
I am new to the dynamic languages scene, and trying to find a good
I recently learned about kayak , an HTTP server written in C# (i.e. not
I want to setup different rails versions with RVM. However, working with the SQLite
Is it okay to start using Iron Ruby and Iron Python in production systems?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.