Exercise: Reference the AutoCAD .NET API Files
 
 
 

In this exercise, you will reference the .NET assemblies acmgd.dll and acdbmgd.dll. After you reference the two files, you will adjust the properties of the referenced files so they are not copied to the build directory.

For more information on referencing AutoCAD .NET API files, see Components of the AutoCAD .NET API.

To reference the AutoCAD .NET API Files

  1. In Microsoft Visual Studio, click View menu Solution Explorer to display the Solution Explorer if it is not already displayed.
  2. In the Solution Explorer, on the toolbar along the top, click Show All Files.
  3. Right-click the References node and click Add Reference.
  4. In the Add Reference dialog box, Browse tab, browse to the install folder of AutoCAD and select acmgd.dll. Press and hold Ctrl, and then select acdbmgd.dll. Click OK.

    The default install location of AutoCAD is <drive>:\Program Files\Autodesk\AutoCAD 2012. If you installed the ObjectARX SDK, you should reference the files from the inc folder.

  5. In the Solution Explorer, click the plus sign to the left the References node to expand it.
  6. Press and hold Ctrl, and select AcDbMgd and AcMdg from the References node.
  7. Right-click over one of the selected references and click Properties.
  8. In the Properties window, click the Copy Local field and then select False from the drop-down list.
    NoteSetting Copy Local to False instructs Microsoft Visual Studio to not include the referenced DLL in the build output for the project. If the referenced DLL is copied to the build output folder, it can cause unexpected results when you load your assembly file in AutoCAD.