locked
COM interop to .NET 2.0 from VB6

    Question

  • Hi,

    We have a VB6 application invoking some functionality from a dll written in .NET framwork 2.0. The .NET dll is enabled for COM interop and is registered using regasm.exe. This has worked in a seamless fashion so far. One customer has started using the application on Windows Server 2008 R2 (64 bit) and they have reported this error.

    Error:

    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

    Run Time Error '2147221164(80040154)':
    The Class is not registered. (HRESULT has the below exception:
    0x800440154(REGDB_E_CLASSNOTREG))  

    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

    I believe that the .NET assembly did not get registered. I have below queries on which any help will be appreciated:

    1. Is there a way to find out the registered COM components on a Windows system. Customer will not be able to access registry on his system but if there is any command that can show the registered COM components, please share.

    2. When running the application on 64 bit system, is it necessary to use 64 bit version of regasm? My understanding is that the VB6 application will run under WOW and thus it should be okay to use 32 bit version of regasm. Is this understanding correct?

    3. Is there any known issue with VB6 application doing COM interop to a .NET 2.0 dll on Windows Server 2008 64 bit.

    Please share if you have any inputs on any of these queries.

    -regards,

    Gaurav

    Wednesday, February 22, 2012 3:59 PM

Answers

  • First, you cannot load a VB 6.0 DLL (which is limited to 32-bit) into a 64-bit process space. If the VB.NET app is going to be running on a 64-bit version of Windows you must set the Platform option (Build...Configuration Manager...) to x86 prior to compiling. This will force the VB.NET app to run 32-bit regardless of the environment.


    Paul ~~~~ Microsoft MVP (Visual Basic)

    Thursday, February 23, 2012 7:31 PM