user7808679
user7808679

Reputation: 127

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())

Upvotes: 3

Views: 1672

Answers (1)

Dairon
Dairon

Reputation: 158

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.

Upvotes: 4

Related Questions