我有一个.NET标准2.0类库,我正试图从Python中使用它。 该库依赖于一些私有和公共NuGet包。在
我成功地从artifact on appveyor安装了pythonnet
的最新版本,我可以运行以下导入代码:
import clr
import sys
sys.path.append(r'C:\....\My.Library\bin\Debug\netstandard2.0')
ref = clr.AddReference("My.Library")
上面的代码运行良好,但是当我试图从我的模块命名空间导入。。。在
^{pr2}$当我尝试做ref.get_ExportedTypes()
时,我得到了:
System.IO.FileNotFoundException:
Die Datei oder Assembly "Google.Protobuf, Version=3.6.0.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604"
oder eine Abhängigkeit davon wurde nicht gefunden.
Das System kann die angegebene Datei nicht finden.
bei System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes)
bei System.Reflection.RuntimeAssembly.GetExportedTypes()
本质上,这是一个关于NuGet依赖项的FileNotFoundException。 什么是正确的方式来构造我的DLL文件/导入它与NuGet依赖?在
谢谢
通过将所有依赖项放在一个目录中,导入就可以工作了。在How to get .NET Core projects to copy NuGet references to build output?中介绍了如何实现这一点的几个选项,例如
dotnet publish
相关问题 更多 >
编程相关推荐