c# - IronPython ArgumentTypeException custom class -


I'm just starting with IronPython and I have some difficulties using my .NET dll

I found the assemblyA reference assemblyB with two assemblies assembly A and assembly B . In each assembly, I have a class with such prototype:

assembly A

  Nameshree assembly by using assembly {public class} {private assembly B. class B Property; Public Assembly B class B property {get; Set;}}}   

assembly

  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   

Any suggestions on how to fix this issue? I think because assemblyB is loaded twice, but I have only one assembly B.dll, so why was not it recognized?

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:

  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

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -