October 27th, 2010, 12:39 pm
Hmmm... worked for me.PS C:\> type test\x.csusing System;namespace ClassLibrary1{public class Class1{public static int AddOne(int n){return ++n;}}}PS C:\> & 'C:\Program Files (x86)\IronPython 2.6 for .NET 4.0\ipy.exe'IronPython 2.6.2 (2.6.10920.0) on .NET 4.0.30319.1Type "help", "copyright", "credits" or "license" for more information.>>> import os>>> os.chdir('c:/test')>>> os.listdir(os.curdir)['x.cs', 'x.dll', 'x.pdb']>>> import clr>>> clr.AddReference('x.dll')Traceback (most recent call last): File "<stdin>", line 1, in <module>IOError: System.IO.IOException: Could not add reference to assembly x.dll at Microsoft.Scripting.Actions.Calls.MethodCandidate.Caller.Call(Object[] args, Boolean& shouldOptimize) at IronPython.Runtime.Types.BuiltinFunction.BuiltinFunctionCaller`2.Call1(CallSite site, CodeContext context, TFuncType func, T0 arg0) at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2) at IronPython.Runtime.Types.BuiltinFunction.BuiltinFunctionCaller`2.Call1(CallSite site, CodeContext context, TFuncType func, T0 arg0) at IronPython.Compiler.Ast.CallExpression.Invoke1Instruction.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1) at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx) at IronPython.Compiler.PythonScriptCode.Run(Scope scope) at IronPython.Hosting.PythonCommandLine.<>c__DisplayClass1.<RunOneInteraction>b__0()>>> import sys>>> sys.path.append('c:/test')>>> clr.AddReference('x.dll')>>> from ClassLibrary1 import Class1>>> Class1.AddOne(3)4>>>