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

  • Home
  • SEARCH
  • 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 69357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T19:33:38+00:00 2026-05-10T19:33:38+00:00

I am interested in using/learning RoR in a project where I have to use

  • 0

I am interested in using/learning RoR in a project where I have to use a .NET dll. Is Ruby capable of importing a .NET dll?

  • 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. 2026-05-10T19:33:39+00:00Added an answer on May 10, 2026 at 7:33 pm

    While IronRuby will make short work of talking to your .NET dll (it’ll be literally no code at all), it was abandoned by microsoft, and it never got a large enough open source community to keep it going after that event. I wouldn’t recommend it these days

    Regarding the COM solution, this may actually be a good way to go.

    You don’t need the RubyCOM library – that lets other COM objects call into ruby code. To load COM objects from ruby, you just need the win32ole library, which comes as part of the standard library on windows ruby.

    Whether or not you can load the dll from COM will depend if the .NET dll was built to be ‘Com Visible’. The .NET framework defines a ComVisibleAttribute, which can be applied to either an entire assembly, or specific classes within an assembly. If it is set to true for either the whole assembly, or any classes, then the dll will already be callable from COM without any wrapper code.

    Here’s a test I did.

    Create a new .NET dll project (class library). Here’s an example class I used:

    using System; using System.IO;  namespace ComLib {     public class LogWriter     {         public void WriteLine( string line )         {             using( var log = new StreamWriter( File.OpenWrite( @'c:\log.file' ) ) )             {                 log.WriteLine( line );             }         }     } } 

    Now, under the visual studio project, there is a directory called Properties which contains AssemblyInfo.cs. In this file, there will be the following

    [assembly: ComVisible( false )] 

    Change the false to true. If you don’t want every class in the assembly exposed to COM, then you can leave it set to false in AssemblyInfo.cs and instead put it above each class you want to expose, like this:

    [ComVisible( true )] public class LogWriter .... 

    Now right click on the dll project itself, and from the popup menu, select ‘properties’. In the list of sections, choose Build

    Scroll down, and tick the ‘Register for COM interop’ checkbox. Now when you compile this DLL, visual studio will do the neccessary stuff to load the COM information into the registry. Note if you’re on vista you need to run VS as an administrator for this to work.

    Now that this is done, recompile your dll, and then create a new ruby file.

    In this ruby file, do this:

    require 'win32ole'  lib = WIN32OLE.new('[Solution name].ComLib.LogWriter') lib.WriteLine('calling .net from ruby via COM, hooray!') 

    Where [Solution name] is to be replaced by the name of the solution you just created (default: ‘ClassLibrary1’)

    Ruby that ruby file, and presto! you should see that the text gets written to c:\log.file.

    One problem with this solution is that it requires that the .NET dll is already Com Visible, or if it’s not, you have the ability to recompile it. If neither of these things are true, then you may have to look at other options.

    Good luck!

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

Sidebar

Ask A Question

Stats

  • Questions 138k
  • Answers 139k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You're looking for SqlMetadata.InferFromValue. May 12, 2026 at 7:38 am
  • Editorial Team
    Editorial Team added an answer The 'onchange' name is a little misleading unless you understand… May 12, 2026 at 7:38 am
  • Editorial Team
    Editorial Team added an answer This not too elegant postprocessing solution seems to work for… May 12, 2026 at 7:38 am

Related Questions

I am interested in mastering prefetch-related functions such as _mm_prefetch(...) so when I perform
How do you find a memory leak in Java (using, for example, JHat)? I
I am trying to work out with ORM tool to move over to and
I'm a business major, two-thirds of the way through my degree program, with a

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.