c# - IronPython ArgumentTypeException custom class -
I'm just starting with IronPython and I have some difficulties using my .NET dll
I found the assembly A assembly Any suggestions on how to fix this issue? I think because After many more tests, I finally got a solution I just wanted to add that path Where to find DLL in the system path, and IronPython has to decide which load will be: assemblyA reference
assemblyB with two assemblies
assembly A and
assembly B . In each assembly, I have a class with such prototype:
Nameshree assembly by using assembly {public class} {private assembly B. class B Property; Public Assembly B class B property {get; Set;}}}
namespace assembly {public class} {private double variables; In my code, I load the first two assemblies:
import clr clr.AddReferenceToFileAndPath (r) 'C: \ user \ i \ document \ ..... \ assemblyA.dll' ) Clr.AddReferenceToFileAndPath (r'C: \ user \ me \ document \ ..... \ assemblyB.dll ') import assembly import assemblyB clA = assemblyA.classA () #ok clb = assemblyB.classB () #ok clA .Prop = clB # Error: Expected class B, class B clap found. Prop = assembly b. Class B () # Corresponding error
assemblyB is loaded twice, but I have only one assembly B.dll, so why was not it recognized?
import sys, os, clr sys.path.append (r '[(assembly MyPath for AA] sys.path.append (r '[MyPath for AssemblyB]') clr.AddReferenceToFile ('assemblyA.dll') clr.AddReferenceToFile ('assemblyB.dll') < P> This is related to the problem and I offer an alternative solution here. / P>
Comments
Post a Comment