# Unable to load 'System.Windows.Forms'

**URL:** <https://www.ruby-forum.com/t/unable-to-load-system-windows-forms/121119>\
**Category:** IronRuby\
**Created:** [November 24, 2007, 1:41am UTC](https://www.ruby-forum.com/t/unable-to-load-system-windows-forms/121119 "2007-11-24T01:41:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nfe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/f07891/32.png) [@nfe](https://www.ruby-forum.com/u/nfe)\
**Post date:** [November 24, 2007, 1:41am UTC](https://www.ruby-forum.com/t/unable-to-load-system-windows-forms/121119/1 "2007-11-24T01:41:54Z")

</div>

Hi,

After building IronRuby with the ‘rake compile config=release’ option  
(according to  
[http://ironruby.rubyforge.org/wiki/wiki.pl?BuildingIronRuby](http://ironruby.rubyforge.org/wiki/wiki.pl?BuildingIronRuby)), I am  
having problems with \>\>\> require ‘System.Windows.Forms’…this is what I  
get from the interpreter:

Ruby.Runtime.LoadError: Could not load file or assembly  
‘System.Windows.Forms’ o  
r one of its dependencies. The system cannot find the file specified.  
—\> Syste  
m.IO.FileNotFoundException: Could not load file or assembly  
‘System.Windows.Form  
s’ or one of its dependencies. The system cannot find the file  
specified.  
File name: ‘System.Windows.Forms’  
at System.Reflection.Assembly.nLoad(AssemblyName fileName, String  
codeBase, E  
vidence assemblySecurity, Assembly locationHint, StackCrawlMark&  
stackMark, Bool  
ean throwOnFileNotFound, Boolean forIntrospection)  
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef,  
Evidence  
assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)  
at System.Reflection.Assembly.InternalLoad(String assemblyString,  
Evidence as  
semblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)  
at System.Reflection.Assembly.Load(String assemblyString)  
at  
Microsoft.Scripting.Hosting.PlatformAdaptationLayer.LoadAssembly(String  
na  
me)  
at Ruby.Runtime.Loader.InternalLoadModule(String path, LoadFlags  
loadFlags, F  
ileKind& kind, SourceUnit& sourceUnit, Assembly& assembly)  
at Ruby.Runtime.Loader.LoadModule(CodeContext context, Object self,  
String pa  
th, LoadFlags flags)

I ran IronRubyTestHost.exe without problems but when I run ‘rake test’,  
I get the following:

\*\* Invoke test (first\_time)  
\*\* Invoke happy (first\_time)  
\*\* Execute happy  
\*\* Invoke test\_libs (first\_time)  
\*\* Execute test\_libs  
“C:\NETPrj\IronRuby\build\debug\rbx.exe” “test\_dir.rb”  
rake aborted!  
undefined method `exitstatus' for nil:NilClass c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:730:in `sh’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:737:in `call' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:737:in `sh’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:816:in `sh' C:/NETPrj/IronRuby/rakefile:195:in `exec’  
C:/NETPrj/IronRuby/rakefile:201:in `exec_net' C:/NETPrj/IronRuby/rakefile:556 C:/NETPrj/IronRuby/rakefile:556:in `each’  
C:/NETPrj/IronRuby/rakefile:556  
C:/NETPrj/IronRuby/rakefile:554:in `chdir' C:/NETPrj/IronRuby/rakefile:554 C:/NETPrj/IronRuby/rakefile:553:in `each’  
C:/NETPrj/IronRuby/rakefile:553  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:399:in `call' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:399:in `execute’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:399:in `each' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:399:in `execute’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:369:in `invoke' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:362:in `synchronize’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:362:in `invoke' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:376:in `invoke\_prerequisit  
es’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:1021:in `each' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:1021:in `send’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:1021:in `each' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:375:in `invoke\_prerequisit  
es’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:368:in `invoke' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:362:in `synchronize’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:362:in `invoke' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:1935:in `run’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:1935:in `each' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:1935:in `run’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/bin/rake:7  
c:/ruby/bin/rake.bat:20:in `load’  
c:/ruby/bin/rake.bat:20

Sorry for the long email…but can someone help?

Thanks!  
nfe

---

<div class="post-metadata">

**Author:** ![nfe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/f07891/32.png) [@nfe](https://www.ruby-forum.com/u/nfe)\
**Post date:** [November 27, 2007, 11:06pm UTC](https://www.ruby-forum.com/t/unable-to-load-system-windows-forms/121119/2 "2007-11-27T23:06:39Z")

</div>

Try using the strong name:

C:\lang\IronRuby\Build\Release\>rbx  
IronRuby Pre-Alpha (1.0.0.0) on .NET 2.0.50727.1378  
Copyright © Microsoft Corporation. All rights reserved.

> > > require ‘System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’  
> > > =\> true
> 
> > >

I got that info from C:\Windows\Assembly (if you don’t already have it  
memorized. ;))

Cory

---

<div class="post-metadata">

**Author:** ![nfe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/f07891/32.png) [@nfe](https://www.ruby-forum.com/u/nfe)\
**Post date:** [November 28, 2007, 4:37am UTC](https://www.ruby-forum.com/t/unable-to-load-system-windows-forms/121119/3 "2007-11-28T04:37:56Z")

</div>

Cory F. wrote:

> Try using the strong name:
> 
> C:\lang\IronRuby\Build\Release\>rbx  
> IronRuby Pre-Alpha (1.0.0.0) on .NET 2.0.50727.1378  
> Copyright © Microsoft Corporation. All rights reserved.
> 
> > > > require ‘System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’  
> > > > =\> true
> > 
> > > >
> 
> I got that info from C:\Windows\Assembly (if you don’t already have it  
> memorized. ;))
> 
> Cory

Thanks Cory! That did the trick…now to memorize or resort to the good  
ole cut and paste when using the interactive console…

---

<div class="post-metadata">

**Author:** ![nfe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/f07891/32.png) [@nfe](https://www.ruby-forum.com/u/nfe)\
**Post date:** [November 28, 2007, 4:42am UTC](https://www.ruby-forum.com/t/unable-to-load-system-windows-forms/121119/4 "2007-11-28T04:42:25Z")

</div>

In IronPython we’ll fall back to LoadWithPartialName which allows  
clr.AddReference(‘System.Windows.Forms’) to work. Maybe IronRuby should  
consider doing the same thing?

* * *

From: removed\_email\_address@domain.invalid  
[removed\_email\_address@domain.invalid] On Behalf Of N. F.  
[removed\_email\_address@domain.invalid]  
Sent: Tuesday, November 27, 2007 7:37 PM  
To: removed\_email\_address@domain.invalid  
Subject: Re: [Ironruby-core] unable to load ‘System.Windows.Forms’

Cory F. wrote:

> memorized. ;))
> 
> Cory

## Thanks Cory! That did the trick…now to memorize or resort to the good ole cut and paste when using the interactive console…

Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

* * *

Ironruby-core mailing list  
removed\_email\_address@domain.invalid  
[http://rubyforge.org/mailman/listinfo/ironruby-core](http://rubyforge.org/mailman/listinfo/ironruby-core)
