I also created a namespace, a class, and a Main method for an entry point as it is going to run as a stand-alone application:
- [assembly: CommandClass(typeof(OutOfProcess.OutOfProcess))]namespace OutOfProcess {public class OutOfProcess{ public static void Main() { OutOfProcess.ConnectToAcad(); }
After this point, the ConnectToAcad() method appears just as in the above code snippet.
I only included these elements in order to get it to work and because all the previous examples had them and I'm not experienced enough to know whether or not they can, or should, be left out.
On top of that, I did everything the Autodesk guide told me to do whenever interfacing with AutoCAD APIs - namely: reference acmgd.dll, acdbmgd.dll, accui.dll (as needed - but I referenced them all anyway), and to set their copy local property to false. Also, to set the target framework to .NET Framework 3.5.
So I did all that, and the build gives me an error that says:
This refers to the line using Autodesk.AutoCAD.Interop;
Am I missing an assembly reference? I brought in all the .dll's it says (i.e. acmgd.dll, acdbmgd.dll, accui.dll) and set their copy local property to false. Is there some other assembly I need?
The guide says
Since the code does seem to use that ProgID, I'm assuming I do have to reference something related to COM interop (I have no idea what this is, so I'm not sure what I'm doing here).
Ive tried variants of the above - for example, setting the framework to 4.0, taking out the namespace stuff, etc. - but none of it works. I've also searched high and low for what kind of assembly interop requires or where to find it.
Any ideas?
Thanks