For a standalone app that automates AutoCAD over COM, set Embed Interop Types to True on the AutoCAD interop references. This prevents you from having to distribute the interop DLLs with your app, and it works the same on .NET Framework and on modern .NET.
Why the reference settings matter
A standalone app is not hosted by AutoCAD, so nothing has loaded the interop assemblies for it. If they are not embedded and not copied next to your EXE, the app creates the AutoCAD instance and then fails the first time it touches an AutoCAD type:
System.IO.FileNotFoundException: Could not load file or assembly
'Autodesk.AutoCAD.Interop, Version=26.0.0.0, Culture=neutral, PublicKeyToken=null'.
The system cannot find the file specified.
The guidance differs between in-process add-ins and standalone apps:
- In-process add-ins reference the .NET API assemblies (
acdbmgd.dll,acmgd.dll,accoremgd.dll). Set Copy Local toFalsefor these. AutoCAD has already loaded its own copies, and the SDK copies are reference assemblies that should not sit next to your add-in. - Standalone apps cannot use those .NET API assemblies at all. They use the COM API through
Autodesk.AutoCAD.Interop.dllandAutodesk.AutoCAD.Interop.Common.dll, which the app must either embed or carry with it.
What we tested
We built the same small standalone app for .NET Framework 4.8 with AutoCAD 2024 and for .NET 10 with AutoCAD 2027, and tried every combination of the two reference settings. The results are identical on both runtimes:
| Target | Embed Interop Types | Copy Local | Result |
|---|---|---|---|
| .NET Framework 4.8, AutoCAD 2024 | False |
False |
Fails: FileNotFoundException |
| .NET Framework 4.8, AutoCAD 2024 | False |
True |
Works |
| .NET Framework 4.8, AutoCAD 2024 | True |
False |
Works |
| .NET Framework 4.8, AutoCAD 2024 | True |
True |
Works |
| .NET 10, AutoCAD 2027 | False |
False |
Fails: FileNotFoundException |
| .NET 10, AutoCAD 2027 | False |
True |
Works |
| .NET 10, AutoCAD 2027 | True |
False |
Works |
| .NET 10, AutoCAD 2027 | True |
True |
Works |
The only failing combination is when neither setting makes the interop types available at runtime. The interop assemblies are not strong-named (PublicKeyToken=null), so the Global Assembly Cache cannot supply them on any runtime.
Option 1: embed the interop types (recommended)
Set Embed Interop Types to True on both references. The compiler copies the interface and enum definitions your code uses into your own assembly, so there is nothing to distribute and Copy Local no longer matters.
<ItemGroup>
<Reference Include="Autodesk.AutoCAD.Interop">
<HintPath>D:\SDKS\ARX2027\inc-x64\Autodesk.AutoCAD.Interop.dll</HintPath>
<EmbedInteropTypes>true</EmbedInteropTypes>
</Reference>
<Reference Include="Autodesk.AutoCAD.Interop.Common">
<HintPath>D:\SDKS\ARX2027\inc-x64\Autodesk.AutoCAD.Interop.Common.dll</HintPath>
<EmbedInteropTypes>true</EmbedInteropTypes>
</Reference>
</ItemGroup>
Embedding has limits. Microsoft documents them in Walkthrough: Embed types from managed assemblies in Visual Studio; for example, constants are not embedded. Our test covered a short flow (create AutoCAD, show it, read the version, quit), so test the parts of the object model your app uses.
Option 2: ship the interop assemblies
Keep Embed Interop Types set to False and set Copy Local to True, so both DLLs are copied next to your EXE. Use the interop assemblies that match the AutoCAD release you target.
Option 3: late binding
Skip the interop references and talk to the COM objects through late binding (dynamic or reflection). You give up compile-time checking, but the app does not depend on a specific interop assembly.
Connecting to AutoCAD
Use the version-specific ProgID, and build the app as x64. For AutoCAD 2027 the ProgID is AutoCAD.Application.26; a trailing .0 fails with CO_E_CLASSSTRING (0x800401F3).
Type type = Type.GetTypeFromProgID("AutoCAD.Application.26", throwOnError: true)!;
object acad = Activator.CreateInstance(type)!;
var app = (AcadApplication)acad;
app.Visible = true;
Console.WriteLine($"AutoCAD version: {app.Version}");
app.Quit();
Best practices at a glance
- Standalone app using COM: set Embed Interop Types to
True. If you prefer to keep itFalse, set Copy Local toTrue. Late binding is the third option. - In-process add-in: set Copy Local to
Falseforacdbmgd,acmgdandaccoremgd. - .NET API assemblies: use them only inside AutoCAD, never from a standalone app.
For out-of-process workflows, APS Automation is also a possible approach.

Leave a Reply