C# Cannot Convert

C# Cannot Convert

Anonymous
Not applicable
1,836 Views
9 Replies
Message 1 of 10

C# Cannot Convert

Anonymous
Not applicable
Hi everybody i'm coding in C#, and i referenced the : using Autodesk.AutoCAD.Interop; using Autodesk.AutoCAD.Interop.Common; But when i Run the code i get thoses errors in the attached image
0 Likes
Accepted solutions (2)
1,837 Views
9 Replies
Replies (9)
Message 2 of 10

Anonymous
Not applicable
Got these errors : Error 5 Argument 1: cannot convert from 'Autodesk.AutoCAD.Interop.AcadDocument [h:\CESBRON\Traceur\SmoothProgressBar.cs]' to 'Autodesk.AutoCAD.Interop.AcadDocument' H:\CESBRON\Traceur\Dessin.cs 53 52 Traceur Error 7 Argument 1: cannot convert from 'Autodesk.AutoCAD.Interop.AcadDocument [h:\CESBRON\Traceur\SmoothProgressBar.cs]' to 'Autodesk.AutoCAD.Interop.AcadDocument' H:\CESBRON\Traceur\Dessin.cs 123 52 Traceur Error 9 Argument 1: cannot convert from 'Autodesk.AutoCAD.Interop.AcadDocument [h:\CESBRON\Traceur\SmoothProgressBar.cs]' to 'Autodesk.AutoCAD.Interop.AcadDocument' H:\CESBRON\Traceur\Dessin.cs 170 52 Traceur Error 12 Argument 1: cannot convert from 'Autodesk.AutoCAD.Interop.AcadDocument [h:\CESBRON\Traceur\SmoothProgressBar.cs]' to 'Autodesk.AutoCAD.Interop.AcadDocument' H:\CESBRON\Traceur\Doc.cs 205 30 Traceur Error 3 Argument 1: cannot convert from 'ref Autodesk.AutoCAD.Interop.AcadSelectionSet [h:\CESBRON\Traceur\SmoothProgressBar.cs]' to 'ref Autodesk.AutoCAD.Interop.AcadSelectionSet' H:\CESBRON\Traceur\Automation.cs 42 43 Traceur Error 1 The best overloaded method match for 'DLLSelectionSet.SelectSelectionSet.SelectSSet(ref Autodesk.AutoCAD.Interop.AcadSelectionSet)' has some invalid arguments H:\CESBRON\Traceur\Automation.cs 42 9 Traceur Error 4 The best overloaded method match for 'GetPointCoord.GetPointCoord.GetPoint(Autodesk.AutoCAD.Interop.AcadDocument, ref object, ref object)' has some invalid arguments H:\CESBRON\Traceur\Dessin.cs 53 9 Traceur Error 6 The best overloaded method match for 'GetPointCoord.GetPointCoord.GetPoint(Autodesk.AutoCAD.Interop.AcadDocument, ref object, ref object)' has some invalid arguments H:\CESBRON\Traceur\Dessin.cs 123 9 Traceur Error 8 The best overloaded method match for 'GetPointCoord.GetPointCoord.GetPoint(Autodesk.AutoCAD.Interop.AcadDocument, ref object, ref object)' has some invalid arguments H:\CESBRON\Traceur\Dessin.cs 170 9 Traceur Error 11 The best overloaded method match for 'GetPointCoord.GetPointCoord.GetPoint(Autodesk.AutoCAD.Interop.AcadDocument, ref object, ref object)' has some invalid arguments H:\CESBRON\Traceur\Doc.cs 205 7 Traceur Error 10 The type 'Autodesk.AutoCAD.Interop.AcadDocument' is defined in an assembly that is not referenced. You must add a reference to assembly 'Autodesk.AutoCAD.Interop, Version=18.0.0.0, Culture=neutral, PublicKeyToken=eed84259d7cbf30b'. H:\CESBRON\Traceur\Doc.cs 201 7 Traceur Error 2 The type 'Autodesk.AutoCAD.Interop.AcadSelectionSet' is defined in an assembly that is not referenced. You must add a reference to assembly 'Autodesk.AutoCAD.Interop, Version=18.0.0.0, Culture=neutral, PublicKeyToken=eed84259d7cbf30b'. H:\CESBRON\Traceur\Automation.cs 42 9 Traceur This is my Github : https://github.com/borisdagnon/CESBRON/tree/master/Traceur
0 Likes
Message 3 of 10

_gile
Consultant
Consultant
Accepted solution

Hi,

 

You have to compile your project and all its home made dependant libraries against the same AutoCAD.Interop version libraries (i.e. the AutoCAD version you're targeting).



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 4 of 10

Anonymous
Not applicable
I'm targeting Autocad 2016 and i referenced all the dll of the 2016 version. But i'm still having a problem with Error 2 The type 'Autodesk.AutoCAD.Interop.AcadSelectionSet' is defined in an assembly that is not referenced. You must add a reference to assembly 'Autodesk.AutoCAD.Interop, Version=18.0.0.0, Culture=neutral, PublicKeyToken=eed84259d7cbf30b'. H:\CESBRON\Traceur\Automation.cs 42 9 Traceur I don't know what to change, when i replace by the Autocad 2010 assemblies it does work. A very confusing problem
0 Likes
Message 5 of 10

norman.yuan
Mentor
Mentor

You may want to provide more details on not only what versio of AutoCAD you are targeting and what versio of AutoCAD you ARE USING for your developing/debugging.

 

To me, it looks like you are running older version of AutoCAD (older than AutoCAD 2016) in your debugging. That is why you cannot use new version of AutoCAD COM Interop assembly. Your developing/debugging AutoCAD cannot be newer COM interop assembly. You should use the same version of Interop assembly as your running AutoCAD for your development. And yes, your application developed for the older version of AutoCAD would likely run OK with newer version of AutoCAD, as long as the CAD features used in your application are not broken by newer AutoCAD, which happens very rarely (but do happen from version to version occassionally, or intentionally).

 

Targeting multiple versions of AutoCAD is always risky, In general, your best bet is to use the same version as the target version for your development.

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 6 of 10

Anonymous
Not applicable
Accepted solution
I found the solution 😄 I have to decompile the GetPointCoord.dll and DLLSelectionset.dll with JetBrains or another decompiler and change the using Autodesk.AutoCAD.Interop; using Autodesk.AutoCAD.Interop.Common with the 2016 version dll and recompile GetPointCoord.dll and DLLSelectionset.dll. After that i went in my Traceur project and referenced the two dlls. Thank you About _gile 😄 you were righ but i didn't understood at the moment.
0 Likes
Message 7 of 10

kerry_w_brown
Advisor
Advisor
 
 
Who is the author of the GetPointCoord.dll and DLLSelectionset.dll that you decompiled ??
 
 
 
 
 

// Called Kerry or kdub in my other life.

Everything will work just as you expect it to, unless your expectations are incorrect. ~ kdub
Sometimes the question is more important than the answer. ~ kdub

NZST UTC+12 : class keyThumper<T> : Lazy<T>;      another  Swamper
0 Likes
Message 8 of 10

Anonymous
Not applicable
I don't realy now, when i search for, i dind't foud anyone. But according to what you're saying how do i have to compile the dlls without decompiling the dlls ?
0 Likes
Message 9 of 10

dgorsman
Consultant
Consultant

I think the point was de-compiling/disassembling somebody else's code without permission is at best frowned upon, and at worst legally actionable.

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


0 Likes
Message 10 of 10

Anonymous
Not applicable
I'm part of a society and the dlls were developed by a worker of our organization don't mind everything is alright, i'm not a hacker guys :-D.
0 Likes