在IronPython问题中导入C#dll的点名文件

时间:2016-03-19 15:38:45

标签: import assemblies ironpython

我一直在尝试使用IronPython导入两个C#.dll。一个叫做m1.sdk.dll,另一个叫做m1.sdk.something.dll。但我得到了错误。错误消息显示它无法在m1.sdk.something.dll中找到类型。

但是它们是通过clr.AddReferenceToFileAndPath()加载并导入IronPython。我看到他们通过clr.References

有没有办法加载这些.dll所以尽管名字点缀IronPython看看同样的模块怎么样?

import clr

clr.AddReferenceToFileAndPath("c:\\path_to_file_\\m1.sdk.dll")
clr.AddReferenceToFileAndPath("c:\\path_to_file_\\m1.sdk.something.dll")

import m1.sdk
import m1.sdk.something     # The error occurs here

* Traceback(最近一次调用最后一次):

文件“”,第1行,

ImportError:没有名为*

的模块

enter image description here

1 个答案:

答案 0 :(得分:0)

您遇到的问题很可能与两个引用的程序集的名称或相似性无关。 如果找不到包含命名空间No module named something的公共/可见类型,则会出现m1.sdk.something