I have been trying to interface to AutoCAD from my VS 2010 project without luck.
My environment is 64bit windows 7 environment. I installed on my computer AutoCad 2012 and ObjectARX 2012.
I created a basic hello world project where I referenced the AcCui.dll AcDbMgd.dll AcMgd.dll but I keep getting errors when running it.
An unhandled exception of type 'System.IO.FileNotFoundException' occurred in Unknown Module.
Additional information: Could not load file or assembly 'Acmgd, Version=126.96.36.199, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
I have tried it with "Copy Local" false (also with true), I have tried to reference the dlls from the ObjectARX directories as well as the AutoCAD installation folders without luck.
Any insight would be apprecaited.
Solved! Go to Solution.
How did you try "to interface to AutoCAD from VS2010 project"? Is your VS2010 project a windows class library (*.dll) and you loaded into AutoCAD with "NETLOAD" command, or is it an EXE project?
If it is latter, then you cannot use the said AutoCAD API assemblies iin an exe project.
I'm afraid it is an exe. We have a very old custom vb6 application that was able to lunch AutoCad with a specified dwg file, then it was able to capture clicks from the autocad gui capturing data from the clicked object, do some computations and create reports.
We managed to compile it so far so it still somewhat runs with 2012, howerver, we need to migrate it to the VS 2010 C# envrionemnt.
What is the most up to date way to achieve this type of functionality?
Thank you for your help,
Obviously, you did not read or understand the posts correctly:
If you are to do a stand-alone EXE project (be it Win Form app or console app), you CAN NOT use AutoCAD .NET API assemblies (acdbmgd.dll, acmgd.dll). End of story.
The OP's solution is to add reference to COM API (in the "Add references" dialog box, go to "COM" tab and then set reference to AutoCAD Type library and/or Acad ObjectDBX Command type library.
In your case (by seeing your attached error picture, you need to remove reference to acdbmsg.dll/acmgd.dll fromo your project.