4

I have a sharpsvn .net library i want to use in ironpython project. Library is shipped as a .ney .dll file. For C# projects i just add this file to project "Reference" section and after that i can use a library:

alt text http://j.mp/8Y3MfL

But for IronPython, the "Reference" section opens very strange window i can't figure out how to add .dll reference to it. Is it any way to reference .net .dll library in IronPython other than GAC?

alt text http://j.mp/az6XLW

grigoryvp
  • 40,413
  • 64
  • 174
  • 277

3 Answers3

6

Add Reference dialog should not be used. Instead you can

import clr
clr.AddReferenceToFileAndPath(...) ' with path

or configure SearchPath directory and use AddReference

import clr
clr.AddReference("SharpSvn")
desco
  • 16,642
  • 1
  • 45
  • 56
  • First samle throws exception 'file not found'. File with path in exception exists. Second one throws IOError with "Could not add reference to assembly SharpSvn" :( – grigoryvp Aug 05 '10 at 13:27
  • 1
    The error is that SharpSvn assembly is built against .net 2.0 and cannot be used by 4.0 runtime without additional configuration Issue itself and workarounds are described here - http://ironpython.codeplex.com/workitem/26165. – desco Aug 05 '10 at 17:20
  • Thanks alot. But with link provided it's only a question without an answer. The last message from topicstarter is "never mind, i have done it myself" :(. Maybe you have information about exact steps i need to perform in oder to use this .NET 2.0 .dll with IronPython? – grigoryvp Aug 06 '10 at 12:37
  • 2
    you need to add or modify file ipy.exe.config with content – desco Aug 06 '10 at 14:14
  • If I added this lines I get WARNING: The runtime version supported by this application is unavailable. Using default runtime: v1.1.4322 ** (/usr/lib/ironpython/ipy.exe:8994): WARNING **: Missing method System.Environment::SetEnvironmentVariable(string,string) in assembly /usr/lib/mono/1.0/mscorlib.dll, referenced in assembly /usr/lib/ironpython/ipy.exe Unhandled Exception: System.MissingMethodException: Method not found: 'System.Environment.SetEnvironmentVariable'. – JuanPablo Aug 29 '11 at 05:27
  • @desco A contents of manifest must start with tag. – Kyokook Hwang Nov 09 '11 at 13:01
2

You add them in the script itself, something like this.

import clr
clr.AddReferenceToFileAndPath("SharpSvn.dll")
Gary
  • 5,642
  • 1
  • 21
  • 41
1

You need to go to the IronPython solution and right-click on Search path and Add a new search path. Once this is done the folder your DLL is in will be in the search path like the screen shot

Search Path http://www.freeimagehosting.net/uploads/aef2b4a74f.png

Once that is done you need to do

import clr
clr.AddReference("SharpSvn.dll")
AutomatedTester
  • 22,188
  • 7
  • 49
  • 62
  • A good example of why you should avoid using external links in SO. The png link above does not take you to an image. – batpox May 30 '21 at 12:18