# Difference between requiring a DLL versus using an assembly name?

**URL:** <https://www.ruby-forum.com/t/difference-between-requiring-a-dll-versus-using-an-assembly-name/139778>\
**Category:** IronRuby\
**Created:** [June 6, 2008, 10:23pm UTC](https://www.ruby-forum.com/t/difference-between-requiring-a-dll-versus-using-an-assembly-name/139778 "2008-06-06T22:23:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![s450r1](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/87869e/32.png) [@s450r1](https://www.ruby-forum.com/u/s450r1)\
**Post date:** [June 6, 2008, 10:23pm UTC](https://www.ruby-forum.com/t/difference-between-requiring-a-dll-versus-using-an-assembly-name/139778/1 "2008-06-06T22:23:02Z")

</div>

Hi,

A couple weeks ago, I started using IronRuby to unit test my C# code.  
I was amazed how well it worked. The IronRuby team has done an  
amazing job! I’m tremendously impressed.

When I first started using IronRuby, support for requiring DLLs had  
just been removed. Because of this, I had the Rake “spec” task copy  
the DLLs I was going to test to the directory containing ir.exe.  
Yesterday I started modifying the code to require the DLLs instead of  
using the assembly names. This works fine for my non-signed DLLs, but  
for some reason doesn’t work with the signed Rhino.Mocks.dll. (This  
is with revision r113.)

Below is transcript of the issue I found. In the interactive IronRuby  
session, notice how the code doesn’t work when the Rhino.Mocks.dll is  
required, but does work after ‘Rhino.Mocks, Version=2.9.6.40350,  
Culture=neutral, PublicKeyToken=0b3305902db7183f’ is required.

d:/jad/tmp/Foo $ cat Bar.cs  
namespace Foo  
{  
using System;  
using Rhino.Mocks;

```
public class Bar
{
    private MockRepository mocks;

    public Bar(MockRepository mocks)
    {
        this.mocks = mocks;
    }

```

}  
}  
d:/jad/tmp/Foo $ ls  
Bar.cs Rhino.Mocks.dll  
d:/jad/tmp/Foo $ csc /t:library /r:Rhino.Mocks.dll Bar.cs  
Microsoft ® Visual C# .NET Compiler version 7.10.6001.4  
for Microsoft ® .NET Framework version 1.1.4322  
Copyright © Microsoft Corporation 2001-2002. All rights reserved.

d:/jad/tmp/Foo $ ls  
Bar.cs Bar.dll Rhino.Mocks.dll  
d:/jad/tmp/Foo $ ls ~/tmp/ironruby/trunk/build/debug/Rhino.Mocks.dll  
d:/jad/tmp/ironruby/trunk/build/debug/Rhino.Mocks.dll  
d:/jad/tmp/Foo $ ir  
IronRuby 1.0.0.0 on .NET 2.0.50727.1433  
Copyright © Microsoft Corporation. All rights reserved.

Note that local variables do not work today in the console.  
As a workaround, use globals instead (eg $x = 42 instead of x = 42).

> > > require ‘Rhino.Mocks.dll’  
> > > =\> true
> 
> > > require ‘Bar.dll’  
> > > =\> true
> 
> > > $mocks = Rhino::Mocks::MockRepository.new  
> > > =\> #Rhino::Mocks::MockRepository:0x000005c
> 
> > > $bar = Foo::Bar.new($mocks)  
> > > :0:in `Initialize##14': wrong number or type of arguments for`Foo::Bar’ (ArgumentError)

> > > require ‘Rhino.Mocks, Version=2.9.6.40350, Culture=neutral, PublicKeyToken=0b3305902db7183f’  
> > > =\> true
> 
> > > $mocks = Rhino::Mocks::MockRepository.new  
> > > =\> #Rhino::Mocks::MockRepository:0x000005e
> 
> > > $bar = Foo::Bar.new($mocks)  
> > > =\> #Foo::Bar:0x0000060
> 
> > > exit

Is this a bug, or am I doing something incorrectly?

Thanks,  
Jeff
