views:

94

answers:

3

Hello.

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

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

+2  A: 

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

import clr
clr.AddReferenceToFileAndPath("SharpSvn.dll")
Gary
It throws exception 'file not found'. File with path in exception exists.
Eye of Hell
+3  A: 

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
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" :(
Eye of Hell
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
@desco 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?
Eye of Hell
you need to add or modify file ipy.exe.config with content <startup useLegacyV2RuntimeActivationPolicy="true"><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
desco
Thanks, that worked!
Eye of Hell
A: 

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

Once that is done you need to do

import clr
clr.AddReference("SharpSvn.dll")
AutomatedTester