【发布时间】:2010-10-19 16:17:52
【问题描述】:
我在 Visual Studio 2010 中创建了一个类库项目,并添加了以下 VB.Net 类:
Public Class Dumb
Private name As String
Public Sub New(ByVal newName As String)
name = newName
End Sub
Public Sub sayHi()
System.Console.WriteLine("Hi " & name)
End Sub
End Class
我构建了解决方案并生成了一个 DLL 文件(比如 PATH_TO_NEW_DLL)。
在 IronPython 中,当我尝试 clr.AddReferenceToFileAndPath(PATH_TO_NEW_DLL) 时出现以下错误。该文件确实存在于我的计算机上。
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IOError: System.IO.IOException: file does not exist: [PATH_TO_NEW_DLL]
at IronPython.Runtime.ClrModule.AddReferenceToFileAndPath(CodeContext context, String file)
at IronPython.Runtime.ClrModule.AddReferenceToFileAndPath(CodeContext context, String[] files)
at Microsoft.Scripting.Utils.ActionHelper`2.Invoke(Object arg0, Object arg1)
at Microsoft.Scripting.Utils.ReflectedCaller.Invoke(Object[] args)
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 <unnamed>$28.<unnamed>(CodeContext $globalContext, FunctionCode functionCode) in <stdin>:line 1
at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx)
at IronPython.Compiler.PythonScriptCode.Run(Scope scope)
at IronPython.Hosting.PythonCommandLine.<>c__DisplayClass1.<RunOneInteraction>b__0()
【问题讨论】:
标签: vb.net visual-studio-2010 ironpython