user3573690 user3573690 - 1 year ago 130
Vb.net Question

AutoCAD 2014: System.Runtime.InteropServices.COMException (0x80029C4A) (TYPE_E_CANTLOADLIBRARY))

I have created classLibrary dll in vb.net 2013 for AutoCAD 2013 using ObjectARX 2013. It works fine in AutoCAD 2013 32bit & 64 bit (winxp, win7, win8). The same program I copied for AutoCAD 2014 and libraries used ObjectARX 2014. But it give this error when I run in AutoCAD 2014.

Please help me. What should I do?

Application does not support just-in-time (JIT)
debugging. See the end of this message for details.

************** Exception Text **************
System.Runtime.InteropServices.COMException (0x80029C4A): Error loading type library/DLL. (Exception from HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY))
at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at Microsoft.VisualBasic.CompilerServices.VBBinder.InvokeMember(String name, BindingFlags invokeAttr, Type objType, IReflect objIReflect, Object target, Object[] args, String[] namedParameters)
at Microsoft.VisualBasic.CompilerServices.LateBinding.InternalLateCall(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack, Boolean IgnoreReturn)
at PV3D.Module1.Head(Double ID, Double thk)
at PV3D.Form1.Button1_Click_1(Object sender, EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.18408 built by: FX451RTMGREL
CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll
----------------------------------------
Acdbmgd
Assembly Version: 19.1.0.0
Win32 Version: 19.1.18.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202014/AcdbMgd.DLL
----------------------------------------
System
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.18408 built by: FX451RTMGREL
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Core
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.18408 built by: FX451RTMGREL
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
AdApplicationFrame
Assembly Version: 0.0.0.0
Win32 Version: 4.0.19.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202014/AdApplicationFrame.DLL
----------------------------------------
AdWindows
Assembly Version: 4.0.24.0
Win32 Version: 4.0.24.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202014/AdWindows.DLL
----------------------------------------
PresentationFramework
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.18408
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/PresentationFramework/v4.0_4.0.0.0__31bf3856ad364e35/PresentationFramework.dll
----------------------------------------
WindowsBase
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.18408 built by: FX451RTMGREL
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/WindowsBase/v4.0_4.0.0.0__31bf3856ad364e35/WindowsBase.dll
----------------------------------------
PresentationCore
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.18408 built by: FX451RTMGREL
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_64/PresentationCore/v4.0_4.0.0.0__31bf3856ad364e35/PresentationCore.dll
----------------------------------------
System.Xaml
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.18408 built by: FX451RTMGREL
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xaml/v4.0_4.0.0.0__b77a5c561934e089/System.Xaml.dll
----------------------------------------
System.Xml
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.18408 built by: FX451RTMGREL
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
PresentationFramework.Aero2
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.18408 built by: FX451RTMGREL
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/PresentationFramework.Aero2/v4.0_4.0.0.0__31bf3856ad364e35/PresentationFramework.Aero2.dll
----------------------------------------
System.Drawing
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.18408 built by: FX451RTMGREL
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
accoremgd
Assembly Version: 19.1.0.0
Win32 Version: 19.1.18.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202014/accoremgd.DLL
----------------------------------------
Acmgd
Assembly Version: 19.1.0.0
Win32 Version: 19.1.18.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202014/Acmgd.DLL
----------------------------------------
System.Configuration
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.18408 built by: FX451RTMGREL
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
AcWindows
Assembly Version: 19.1.0.0
Win32 Version: 19.1.18.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202014/AcWindows.DLL
----------------------------------------
AcCui
Assembly Version: 19.1.0.0
Win32 Version: 19.1.18.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202014/AcCui.DLL
----------------------------------------
PresentationFramework-SystemXml
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.17929
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/PresentationFramework-SystemXml/v4.0_4.0.0.0__b77a5c561934e089/PresentationFramework-SystemXml.dll
----------------------------------------
PresentationFramework.Aero
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.17929 built by: FX45RTMREL
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/PresentationFramework.Aero/v4.0_4.0.0.0__31bf3856ad364e35/PresentationFramework.Aero.dll
----------------------------------------
WindowsFormsIntegration
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.18408 built by: FX451RTMGREL
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/WindowsFormsIntegration/v4.0_4.0.0.0__31bf3856ad364e35/WindowsFormsIntegration.dll
----------------------------------------
AcWindows.resources
Assembly Version: 19.1.0.0
Win32 Version: 19.1.18.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202014/en-US/AcWindows.resources.DLL
----------------------------------------
PresentationUI
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.17929 built by: FX45RTMREL
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/PresentationUI/v4.0_4.0.0.0__31bf3856ad364e35/PresentationUI.dll
----------------------------------------
System.Xml.Linq
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.17929 built by: FX45RTMREL
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml.Linq/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.Linq.dll
----------------------------------------
System.Windows.Forms
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.18408 built by: FX451RTMGREL
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
PresentationFramework-SystemXmlLinq
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.17929
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/PresentationFramework-SystemXmlLinq/v4.0_4.0.0.0__b77a5c561934e089/PresentationFramework-SystemXmlLinq.dll
----------------------------------------
PV3D
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Users/Fayaz%20Memon/AppData/Roaming/Autodesk/ApplicationPlugins/PV3D.bundle/Contents/PV3D.dll
----------------------------------------
FeaturedAppsPlugin
Assembly Version: 19.0.0.0
Win32 Version: 19.0.55.0.0
CodeBase: file:///C:/ProgramData/Autodesk/ApplicationPlugins/Autodesk%20FeaturedApps.bundle/Contents/Windows/2014/FeaturedAppsPlugin.dll
----------------------------------------
ContextualTabSelectorRules
Assembly Version: 0.0.0.0
Win32 Version: 19.1.18.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202014/AcWindows.dll
----------------------------------------
PresentationFramework-SystemCore
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.17929
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/PresentationFramework-SystemCore/v4.0_4.0.0.0__b77a5c561934e089/PresentationFramework-SystemCore.dll
----------------------------------------
Microsoft.Expression.Interactions
Assembly Version: 4.0.0.0
Win32 Version: 2.0.20520.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202014/Microsoft.Expression.Interactions.DLL
----------------------------------------
ManagedMC3
Assembly Version: 7.2.0.0
Win32 Version: 7.2.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202014/ManagedMC3.DLL
----------------------------------------
UIAutomationTypes
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.17929 built by: FX45RTMREL
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/UIAutomationTypes/v4.0_4.0.0.0__31bf3856ad364e35/UIAutomationTypes.dll
----------------------------------------
Microsoft.VisualBasic
Assembly Version: 10.0.0.0
Win32 Version: 11.0.50709.17929 built by: FX45RTMREL
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualBasic/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
AcLivePreviewContext
Assembly Version: 0.0.0.0
Win32 Version: 19.1.18.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202014/AcWindows.dll
----------------------------------------
UIAutomationProvider
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.17929 built by: FX45RTMREL
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/UIAutomationProvider/v4.0_4.0.0.0__31bf3856ad364e35/UIAutomationProvider.dll
----------------------------------------
AcLayer
Assembly Version: 19.1.0.0
Win32 Version: 19.1.18.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202014/AcLayer.DLL
----------------------------------------
AcLayer.resources
Assembly Version: 19.1.0.0
Win32 Version: 19.1.18.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202014/en-US/AcLayer.resources.DLL
----------------------------------------
PresentationFramework.Luna
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.17929 built by: FX45RTMREL
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/PresentationFramework.Luna/v4.0_4.0.0.0__31bf3856ad364e35/PresentationFramework.Luna.dll
----------------------------------------
AcMrUi
Assembly Version: 19.1.0.0
Win32 Version: 19.1.18.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202014/AcMrUI.DLL
----------------------------------------
AcMrUi.resources
Assembly Version: 19.1.0.0
Win32 Version: 19.1.18.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202014/en-US/AcMrUi.resources.DLL
----------------------------------------
AcMr
Assembly Version: 19.1.0.0
Win32 Version: 19.1.18.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202014/AcMr.DLL
----------------------------------------
System.Runtime.Serialization
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.18408 built by: FX451RTMGREL
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.Serialization/v4.0_4.0.0.0__b77a5c561934e089/System.Runtime.Serialization.dll
----------------------------------------
FeaturedAppsPlugin.resources
Assembly Version: 19.0.0.0
Win32 Version: 19.0.55.0.0
CodeBase: file:///C:/ProgramData/Autodesk/ApplicationPlugins/Autodesk%20FeaturedApps.bundle/Contents/Resources/en-US/FeaturedAppsPlugin.resources.dll
----------------------------------------
Autodesk.AutoCAD.Interop.Common
Assembly Version: 19.1.0.0
Win32 Version: 19.1.18.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202014/Autodesk.AutoCAD.Interop.Common.DLL
----------------------------------------
Autodesk.AutoCAD.Interop
Assembly Version: 19.1.0.0
Win32 Version: 19.1.18.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202014/Autodesk.AutoCAD.Interop.DLL
----------------------------------------

************** JIT Debugging **************
Application does not support Windows Forms just-in-time (JIT)
debugging. Contact the application author for more
information.

Answer Source

When working with AutoCAD (or any other interop) that is likely to change version numbers between development and production or even bitness (x64 vs x86) it is better to use dynamics in C# (object in VB) rather than using references.

In order to have the accurate properties and methods in AutoCAD, you can a dummy project that references the ObjectARX dlls, and then a CAD class that abstracts all access to AutoCAD using objects (formerly variants, and dynamics in C#). I use the dummy project to get the correct spellings for the methods and properties, and then apply the same calls to my actual CAD project

So to get the application object I use:

dynamic _application = Marshal.GetActiveObject("AutoCAD.Application");
dynamic _document = _application.ActiveDocument // Or _application.Documents.Open("...")

VB

object application = GetObject(, "AutoCAD.Application") ' or CreateObject("AutoCAD.Application"
object document = application.ActiveDocument ' Or _application.Documents.Open("...")

The class ID passed to the GetActiveObject method : "AutoCAD.Application" will return the active or last installed version of AutoCAD. So on a machine with multiple versions, you can specify the version you want by specifying the version number in the class ID like this: "AutoCAD.Application.19". You'll need to carry out some research to know what the number should be.

By encapsulating all the AutoCAD features I need in my CAD class, I can call CAD.Line(....), CAD.InsertBlock(...).

Hope this helps.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download