简体   繁体   中英

Python .Net Not loading .Net Standard 2.0 dll

I am new to Python. I developed a C# library .Net Standard 2.0 and i tried to load this in Python using import clr by installing python .net package. The problem is that if I change the version of .net to 1.4 or lower then it works otherwise it show ModuleNotFound Error. Does anyone have idea of dealing with this problem? I don't want to change the version of my .net standard.

import clr
import sys
assemblydir = r"C:\\Python"
assemblypath = r"C:\\Python\Mylib.dll"
sys.path.append(assemblydir)
clr.FindAssembly(assemblypath)
clr.AddReference("Mylib")
from Mylib import Animal
a = Animal()
print (a.Get())

According to the changelog here , NetStandard 2.0 support is added on the unreleased versions. So you are probably using PythonNet 2.3.0 or lower. Try getting Pythonnet 2.4.0 from appveyor . Follow the instructions on the installation wiki .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM