Python for .NET “unable to find assembly” error

前端 未结 6 1754
情书的邮戳
情书的邮戳 2020-12-10 11:42

I\'m using CPython and I have a C# dll. I\'m trying to use Python for .NET to make them talk. I can\'t use IronPython because I need to integrate this into an existing CPy

6条回答
  •  攒了一身酷
    2020-12-10 11:56

    Did you try clr.FindAssembly?

    import clr
    import sys
    assemblydir = r"C:\pyfornet_test"
    assemblypath = r"C:\pyfornet_test\DotNet4Class.dll"
    sys.path.append(assemblydir)
    clr.FindAssembly(assemblypath)
    

    I don't know why it works, but this code works on my computer (Python 2.7, .NET4)

提交回复
热议问题