C# / IronPython Interop with shared C# Class Library

后端 未结 2 1485
旧巷少年郎
旧巷少年郎 2021-02-03 14:24

I\'m trying to use IronPython as an intermediary between a C# GUI and some C# libraries, so that it can be scripted post compile time.

I have a Class library DLL that is

2条回答
  •  心在旅途
    2021-02-03 15:14

    You might try running your program under the debugger and breaking execution prior to the GetVariable call. Go to the "modules" window and see if there are two versions of your C# class library DLL loaded. If that's the case, then that's the explanation.

    If that's the problem, then the solution is to make sure C# and Python worlds agree on the types. One solution is to put everything in the same directory. Another possibility is to set up a reference to your class library in C# by using the properties on the ScriptScope class (I think) to set an assembly reference to your class library assembly that will be available to the Python code. I don't have a hybrid C#/IronPython project immediately available to test against, but I remember seeing that functionality.

提交回复
热议问题