且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

为什么我不能将C#类型导入IronPython?

更新时间:2021-12-14 22:00:20

您是否可以从期望的其他位置获取DLL? AddReferenceToFile将搜索sys.path并加载找到的第一个文件,该文件与该文件名匹配.根据您希望在何处找到DLL以及它可能在路径上的较早位置,可能会得到一个较早编译的版本.您也可以这样做:

Could you be picking up the DLL from a different location then you're expecting? AddReferenceToFile will search sys.path and load the first file it finds which matches that filename. Depending on where you expect to find the DLL and where it may exist earlier on the path you could be getting a version which you've compiled earlier. You can also do:

dir(clr.LoadAssemblyFromFile('SprocGenerator.dll'))

查看您实际上要获取的DLL中存在哪些类型,或者:

to see what types exist in the DLL which you are actually getting back or:

clr.LoadAssemblyFromFile('test.dll').CodeBase

查看文件实际从何处加载.

to see where the file is actually being loaded from.