最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

python - Calling windows-targeted .NET dll using pythonnet - Stack Overflow

programmeradmin2浏览0评论

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?

发布评论

评论列表(0)

  1. 暂无评论