4 Posts
0 Kudos
Registered: ‎11-23-2009
Post 1 of 7

Get the error: Could not load file or assembly 'acdbmgd

2211 Views, 6 Replies
12-01-2009 06:56 AM
We are building a product using the AutoCAD .NET API and Visual Studio 2008 SP1.
Our product needs to support AutoCAD 2007 through 2010.

The OS is XP Professional SP3 and has the following (relevant) programs:
1. AutoCAD 2007, 2008 and 2010, Autodesk DWF Viewer 7, Autodesk Design Review 2010
2. .NET Framework 1.1 thru 3.5 SP1

If it matters, this is all running in a VM.

Visual Studio project details:
I have a project reference to the following AutoCAD DLLs:
1. C:\Program Files\AutoCAD 2007\acdbmgd.dll (Version
2. C:\Program Files\AutoCAD 2007\acmgd.dll (Version
3. The "AutoCAD 2008 Type Library" COM component
4. The "OLE Automation" COM component

When I run the project (with or without debug mode), I get the following System.Reflection.ReflectionTypeLoadException:
{"Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information."}

Here's the value of LoaderException property:
{"Could not load file or assembly 'acdbmgd, Version=, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Invalid pointer (Exception from HRESULT: 0x80004003 (E_POINTER))":"acdbmgd, Version=, Culture=neutral, PublicKeyToken=null"}

If it helps, here are other details:
Source: mscorlib
at System.Reflection.Module._GetTypesInternal(StackCrawlMark& stackMark)
at System.Reflection.Assembly.GetTypes()
at Microsoft.VisualStudio.Tools.UserControlTestContainer.LoadAssemblyFromFile(String fileName)
at Microsoft.VisualStudio.Tools.UserControlTestContainer.UserControlTestContainer_Load(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 nCmdShow)
at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
at System.Windows.Forms.Control.set_Visible(Boolean value)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at Microsoft.VisualStudio.Tools.UserControlTestContainer.Main(String[] args)

I am not sure why I am getting this error. Any help would be greatly appreciated. Thanks.

- Aashish
*Expert Elite*
1,088 Posts
217 Kudos
Registered: ‎04-27-2009
Post 2 of 7

Re: Get the error: Could not load file or assembly 'acdbmgd

12-01-2009 10:57 AM in reply to: AashishM
What kind of product you are doing? A stand-alone exe app (since I saw "... System.Windows.Forms.Application.Run(Form mainForm).." in the error message), or a .NET DLL loading into Acad via "NETLOAD" command?

If it is the former, you cannot use acdbmgd.dll/acmgd.dll in an stand-alone exe app.

If it is the latter, have you set the reference's "Copy to local" to "False"?

Also, if you develop your product against Acad2007/8/9's .NET library (acdbmgd.dll/acmgd.dll), the chances are it may not work, or may not ALWAYS work in Acad2010 or later, depending on what your product does: each Acad major release almost alway something btreaks previous APIs here or there.
4 Posts
0 Kudos
Registered: ‎11-23-2009
Post 3 of 7

Re: Get the error: Could not load file or assembly 'acdbmgd

12-01-2009 11:35 AM in reply to: AashishM
The latter applies in my case, and the "Copy Local" is set to False for all the references. At this time, we don't seem to have API compatibility issues across various versions of AutoCAD, but the thing is I don't even get to the point where ACAD.exe launches (using netload to load the .NET assembly and invoking AutoCAD API methods would happen subsequently).
4 Posts
0 Kudos
Registered: ‎11-23-2009
Post 4 of 7

Re: Get the error: Could not load file or assembly 'acdbmgd

12-01-2009 11:39 AM in reply to: AashishM
Ok, it appears that for some reason, my Visual Studio Project settings got reset. I changed the "Start Action" to launch ACAD.exe, and it now runs fine! I would never have guessed that. Thanks.
4 Posts
0 Kudos
Registered: ‎01-30-2012
Post 5 of 7

Re: Get the error: Could not load file or assembly 'acdbmgd

02-01-2012 11:44 AM in reply to: norman.yuan

if we can not use acdbmgd.dll/acmgd.dll in stand alone exe app. then how can we open drawing ?

i  want to open "*.dwg" file in my exe app. and modify some of the entities from that .dwg file

*Expert Elite*
9,836 Posts
1,219 Kudos
Registered: ‎06-29-2007
Post 6 of 7

Re: Get the error: Could not load file or assembly 'acdbmgd

02-01-2012 11:47 AM in reply to: webdeveloper.michael



use the COM-API instead (reference the Interop.... assemblies) to get access to the AutoCAD ActiveX-Server.


- alfred -

Ingenieur Studio HOLLAUS ... www.hollaus.at
ADN Support Specialist
390 Posts
46 Kudos
Registered: ‎04-30-2009
Post 7 of 7

Re: Get the error: Could not load file or assembly 'acdbmgd

02-02-2012 05:22 AM in reply to: webdeveloper.michael



From external applications (.exe) you can ONLY use AutoCAD COM API, which mean no use of AcMgd or AcDbMgd. Using COM API you can call methods like Open and some changes can be made.


The way around is expose AcMgd and AcDbMgd features through COM to your external application following this blog post: http://through-the-interface.typepad.com/through_the_interface/2009/05/interfacing-an-external-com-a...



Augusto Goncalves
Autodesk Developer Network
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!