I'm trying to call my C# library from python like so:
import sys
import clr
dll_path = r"/path/to/dll/folder"
sys.path.append(dll_path)
clr.AddReference("PyCsLib") # <- always passes
from PyCsLib import TestClass # <- raises an error when targeting net9.0-windows10.0.17763
When the C# project TargetFramework
is net9.0
, it works fine.
However, when I switch to net9.0-windows10.0.17763
, the python code fails on import:
ModuleNotFoundError: No module named 'PyCsLib'
Did I miss something? Or is pythonnet not compatible with such target?