2
我创建了Visual Studio 2010的一个类库项目并创造增加了以下VB.Net类:为什么不能IronPython的发现我的VS2010 VB.Net类库DLL
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)错误。该文件DOES我的计算机上存在。
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()
据http://msdn.microsoft.com/en-us/library/17k74w0c.aspx,“因为类库没有切入点,他们对这个属性的唯一选项是(无)。 “你引用的启动文件和VS2010中的启动对象有区别吗? – ravi77o 2010-10-19 16:50:15
这就是我的意思:http://imgur.com/RbeZY.png 正如你所看到的,'app.py'是我当前的启动文件(其上有一个绿色的图标),我可以改变的启动文件通过右击任何其他文件。这只会改变什么.py文件发送到ipy.exe来启动您的程序。 – Aphex 2010-10-19 17:05:32
我注意到,你指的是你正在做一个类库的事实(大概是从其他应用程序使用)。在这种情况下,请查看是否可以使用与类库相同的文件夹中的DLL。 – Aphex 2010-10-19 17:14:20