• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    AutoCAD 2013/2014 DWG Format

    Reply
    Contributor
    Shamanek
    Posts: 14
    Registered: ‎05-28-2011
    Accepted Solution

    Problems creating instance. Error: 80040154

    350 Views, 2 Replies
    05-21-2012 12:47 AM

    Hello,

    I have a problem creating an instance of the AcadApplicationClass.

    The program is very simple:

    Assembly autodeskWrapper = Assembly.LoadFile(@"C:\Windows\assembly\GAC_MSIL\Autodesk.AutoCAD.Interop\17.0.54.0__eed84259d7cbf30b\Autodesk.AutoCAD.Interop.dll");
                Type acadAppClassType = autodeskWrapper.GetType("Autodesk.AutoCAD.Interop.AcadApplicationClass");
                object m_acadDApplicationClass;
    
                m_acadDApplicationClass = Activator.CreateInstance(acadAppClassType);

     

     

     

    and the exception is:

    Retrieving the COM class factory for component with CLSID {28B7AA99-C0F9-4C47-995E-8A8D729603A1} failed due to the following error: 80040154.

     

    AutoCAD 2013 is installed but no license is provided (there is a 30 day trial period). I am trying to launch AutoCAD.

    In C:\Windows\Assembly folder I can see the Autodesk interops:

     

    Autodesk.AutoCAD.Interop and Autodesk.AutoCAD.Interop.Common. Their version is 17.0.54.0.

    In Component Services\Computers\My Computer\DCom Config I can see an enttry - AutoCAD Drawing. Its CLSID is: 6A221957-2D85-42A7-8E19-BE33950D1DEB.

     

    I`ve read that the exception is because a 32bit process is trying to use 64bit DLL or vice versal. I have compiled my program in both 32bit and 64bit but with no results - I am getting the exception in both cases. Can anyone help me with this ...

     

    Greetings

     

    Please use plain text.
    *Expert Elite*
    Posts: 6,401
    Registered: ‎06-29-2007

    Re: Problems creating instance. Error: 80040154

    05-21-2012 01:08 PM in reply to: Shamanek

    Hi,

     

    >> Their version is 17.0.54.0

    IMHO that's the point to start ==> AutoCAD 2013 has the internal release number 19.0 and not 17.0 which was AutoCAD 2007. So first update the references and then start debugging.

    That your AutoCAD is running in 30-day mode does not make any differences for you (except the startup screen with activation).

     

    BTW. for developing AutoCAD and dotNET there is a special forum >>>there<<<!

     

    - alfred-

    -------------------------------------------------------------------------
    Alfred NESWADBA
    Ingenieur Studio HOLLAUS ... www.hollaus.at
    -------------------------------------------------------------------------
    Please use plain text.
    Contributor
    Shamanek
    Posts: 14
    Registered: ‎05-28-2011

    Re: Problems creating instance. Error: 80040154

    05-22-2012 03:59 AM in reply to: Shamanek

    Hi,

    Yeah you are completely right. After some investigation, I realized that AutoCAD 2013 is not installing the interops in the GAC at all - "If you’re using COM Interop, you’ll find the interop assemblies are no longer registered in the GAC (i.e. you won’t find them on the COM tab in the Add Project References dialog). You’ll now need to browse to Autodesk.AutoCAD.Interop.dll and Autodesk.AutoCAD.Interop.Common.dll (I believe) in the AutoCAD Program Files folder or on the ObjectARX SDK".

     

    So my current code is in vain moreover it`s written in .NET 3.5 while the interops which are located under the installation folder of AutoCAD 2013 are built with .NET 4.0 thus I am not able to load them.

     

    The conclusion is that I have to use the interops in the install dir and build my code with .NET 4.0

    Please use plain text.