.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

6 REPLIES 6
Reply
Message 1 of 7
AashishM
6178 Views, 6 Replies

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

We are building a product using the AutoCAD .NET API and Visual Studio 2008 SP1.
Our product needs to support AutoCAD 2007 through 2010.

Environment:
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 17.0.209.0)
2. C:\Program Files\AutoCAD 2007\acmgd.dll (Version 17.0.209.0)
3. The "AutoCAD 2008 Type Library" COM component
4. The "OLE Automation" COM component

Problem:
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=17.0.209.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Invalid pointer (Exception from HRESULT: 0x80004003 (E_POINTER))":"acdbmgd, Version=17.0.209.0, Culture=neutral, PublicKeyToken=null"}

If it helps, here are other details:
Source: mscorlib
StackTrace:
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
6 REPLIES 6
Message 2 of 7
norman.yuan
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.
Message 3 of 7
AashishM
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).
Message 4 of 7
AashishM
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.
Message 5 of 7

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

Message 6 of 7

Hi,

 

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

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at ... blog.hollaus.at ... CDay 2024
------------------------------------------------------------------------------------
(not an Autodesk consultant)
Message 7 of 7

Hi,

 

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...

 

Regards,



Augusto Goncalves
Twitter @augustomaia
Autodesk Developer Network

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost