none
Exception from HRESULT: 0x80070005 (E_ACCESSDENIED) and HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY) RRS feed

  • Question

  • to start, i did see that users have posted similar questions to the one i am going to ask but they are either highly specific answers or for web development. so here we go....

     

    I am writing a plug-in application for Autodesk Revit so it will communicate with SAP2000 via their respective APIs.  pretty straight forward stuff.  The SAP reference is COM and was attached as such.  The issue is when i reference it in code with the using keyword, the namespace is not found.  and when i build the solution i get the following error:

    Error 1 System.Runtime.InteropServices.COMException - Error loading type library/DLL. (Exception from HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY)) C:\SmartShare\scripts\Revit\branches\BH_Revit_2011\BH_Revit\TlbImp BH_Revit

    after a bit of research, i re-registered the SAP2000 type library using regtlibv12.  i did this on the .exe and .tlb files and the program reported that the registrations were successful.  still getting problems with the build.  i then use tlbimp to manually create the Interop....dll file with the intention of just adding the dll as the reference.  this is where i get the 0x80070005 (E_ACCESSDENIED) exception.  ran it with the '/verbose' parameter and this was the output (output was identical when i ran it on the .tlb):
    *****************************************************************************

    C:\Program Files (x86)\Computers and Structures\SAP2000 14>tlbimp Sap2000.exe /o

    ut:Sap2000_2.dll /verbose

    Microsoft (R) .NET Framework Type Library to Assembly Converter 3.5.30729.1

    Copyright (C) Microsoft Corporation.  All rights reserved.

     

    Resolved referenced file 'Sap2000.exe' to file 'C:\Program Files (x86)\Computers

     and Structures\SAP2000 14\Sap2000.exe'.

    Type '_cPointObj' imported.

    Type 'cPointObj' imported.

    Type 'cPointObj___v0' imported.

    .

    .

    .

    .

    Type 'cBASConcBox' imported.

    Type 'cBASConcBox___v0' imported.

    Type '_cInternal' imported.

    Resolving reference to type library 'CsiGoCallbackLib'.

    Auto importing 'CsiGoCallbackLib' to 'C:\Program Files (x86)\Computers and Struc

    tures\SAP2000 14\CsiGoCallbackLib.dll'.

    Type 'GoCallback' imported.

    Type 'IGoCallback' imported.

    TlbImp : error TI0000 : System.IO.IOException - Access is denied. (Exception fro

    m HRESULT: 0x80070005 (E_ACCESSDENIED))

    *****************************************************************************

     

    so took a look at the .tlb file with dependencywalker2.2 (depends) and and it displays nothing and gave me "Error: At least one file was not a 32-bit or 64-bit Windows module."  next i looked at the .exe file and it's telling me that i'm missing a couple of files so i located them and dropped them in the \SAP2000 14 folder but the issue seems to be the following errors:

     

    *****************************************************************************

    Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module.

    Error: Modules with different CPU types were found.

    *****************************************************************************

    the structure of the SAP2000.exe is as follows
    SAP2000.EXE
    MSVBVM60.dll
    [a bunch of stuff]
    .
    .
    .
    .
    .
    .
    and i see in depends that SAP2000 and MSVBVM60 are built against a x86 machine while all the other dlls under MSVBVM60.dll as built against a x64 machine.  
    not sure where to go from here.  any input would be highly appreciated.  thanks.

    Thursday, July 14, 2011 12:44 AM

Answers

All replies

  • just to clarify, i forgot tabs were not displayed, the structure is:

     

    SAP2000.exe

    --MSVBVM60.dll

    ----[a bunch of other stuff]

    ----.

    ----.

    ----.

    ----.

    ----.

     

    so the only shown dependency of SAP2000 is MSVBVM60 but that is dependent on many other .dlls

    Thursday, July 14, 2011 12:49 AM
  • Hi,

    According to the exception message, you do not have priviledge to access assembly.

    I suggest you Run command as administrator or disable UAC.

    I hope this can help you resolve it.


    Paul Zhou [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, July 19, 2011 8:07 AM
  • Thanks for the reply!

     

    that worked to get the new dll made with tlbimp work.  but the COM reference is still not functioning as expected.  this, i'm coming to figure, is an issue with the SAP COM and not an issue with .NET/visual studio 

    Thursday, July 21, 2011 6:06 PM
  • Hi,

    We can not integrate X86 assemblies and X64 assemblies to one assembly.

    You can try to build the assemblies and depends to target X86.


    Paul Zhou [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Paul Zhou Tuesday, July 26, 2011 5:55 AM
    Monday, July 25, 2011 3:24 AM