[IronPython] How does the clr.AddReferences work?

Dino Viehland dinov at exchange.microsoft.com
Fri Mar 10 03:25:32 CET 2006


Have you added the location of test.dll to your path yet?

If not you need to do that first.  We do not search the current directory, only the path.  So if you want the CWD you'll need to do:

import nt
import clr
clr.Path.append(nt.getcwd())

and then clr.AddReferenceToFile() should work fine.

The finer points of clr.AddReferenceToFile are that the dependencies for the files added this way will be resolved by IronPython.  When we try to get a dependency we'll search the clr.Path list and load the first assembly we find in the list.

The upside to this is that if you're doing a compile, load into IP, debug cycle you can re-load your assembly even though it has the exact same filename.

And as always we'd love to hear feedback about the design here.


Do you want to help develop Dynamic languages on CLR? (http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038)

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Paparipote .
Sent: Thursday, March 09, 2006 6:13 PM
To: users at lists.ironpython.com
Subject: [IronPython] How does the clr.AddReferences work?

Hello,
I have a doubt:

In IP Beta 2, I was able to write:
>>>import clr
>>>clr.AddReferenceToFile("test.dll")
>>>import test
>>>

but in Beta 4, if I write clr.AddReferenceToFile("test.dll")  I get:

Traceback (most recent call last):
  File , line 0, in input##678
  File , line 0, in AddReference##657
RuntimeError: Could not add reference to assembly test.dll

If I do with:
>>>clr.AddReference("System.Xml")
>>>
It works well.

If, in Beta 4,  I write:
>>>import System
>>>import clr
>>>aso = System.Reflection.Assembly.LoadFrom('test.dll')
>>>clr.AddReference(aso)
>>>
It works well.

Question is: Does it mean I should resign to the use of
clr.AddReferenceToFile("test.dll") ???

Or what is bad with my understanding about clr ?

Best regards

_________________________________________________________________
Charla con tus amigos en línea mediante MSN Messenger:
http://messenger.latam.msn.com/

_______________________________________________
users mailing list
users at lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



More information about the Ironpython-users mailing list