locked
COM interop on 64 bit Virtual machine RRS feed

  • Question

  • Hi,

    I have a 32 bit executable (built using VB6) using a COM dll (.NET 2.0 assembly built using x86 platform settings in Visual Studio 2005) running on a 64 bit virtual machine (Windows Server 2008 SP1).

    As soon as the exe makes a call to .NET layer, below error is displayed.

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

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

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

    I have verified that the .NET assembly was registered using 32 bit version of regasm.exe and the entries are there in the registry under HKEY_CLASSES_ROOT\Wow6432Node.

    Any help on this is greatly appreciated.

    -regards,

    Gaurav 

    Monday, March 12, 2012 12:55 PM

Answers

  • Hi Malhotra,

    Welcome to the MSDN forum.

    It seems that you don’t register the dll successfully.

    In general, we register the dll file:  go to the Run item on the Start menu, and type: regsvr32 <path & filename of dll or ocx>. 

    But if you want to use the COM dll in 64bit machine, you need to run Regsvr32.exe from the %SystemRoot%\Syswow64 folder.

    Here is the article: Error Message When You Run Regsvr32.exe on 64-Bit Windows: http://support.microsoft.com/kb/282747 

    If there is error message appearance, please check the following links: Explanation of Regsvr32 usage and error messages: http://support.microsoft.com/kb/249873 

    Hope it helps.


    Mark Liu-lxf [MSFT]
    MSDN Community Support | Feedback to us



    Wednesday, March 14, 2012 3:34 AM
    Moderator
  • If your .Net/COM assembly references other dlls, they have to be registered, too. If these referenced dlls are COM dlls, not only the Interop wrapper has to be supplied and registered (regasm), also the COM dll itself must be distributed and registered (regsvr32). Possibly this applies to your situation.

    Armin

    Monday, March 19, 2012 3:41 PM

All replies

  • Hi Malhotra,

    Welcome to the MSDN forum.

    It seems that you don’t register the dll successfully.

    In general, we register the dll file:  go to the Run item on the Start menu, and type: regsvr32 <path & filename of dll or ocx>. 

    But if you want to use the COM dll in 64bit machine, you need to run Regsvr32.exe from the %SystemRoot%\Syswow64 folder.

    Here is the article: Error Message When You Run Regsvr32.exe on 64-Bit Windows: http://support.microsoft.com/kb/282747 

    If there is error message appearance, please check the following links: Explanation of Regsvr32 usage and error messages: http://support.microsoft.com/kb/249873 

    Hope it helps.


    Mark Liu-lxf [MSFT]
    MSDN Community Support | Feedback to us



    Wednesday, March 14, 2012 3:34 AM
    Moderator
  • Hi Mark,

    Thanks for sharing your inputs.

    I did register the .NET assembly using regasm.exe and also verified that the registry (under Wow6432Node) has entries for types exposed by the .NET assembly. Is that not sufficient to conclude that .NET assembly is correctly registered? What makes you think the .NET assembly was not successfully registered?

    I am just trying to understand the logic behind your statement as the problem occurs for a specific customer and I need to explain the root cause to the customer.

    Also, I do not think I should use regsvr32.exe as it is a .NET assembly and regasm.exe should be used.

    -regards,

    Gaurav


    Sunday, March 18, 2012 3:04 PM
  • If your .Net/COM assembly references other dlls, they have to be registered, too. If these referenced dlls are COM dlls, not only the Interop wrapper has to be supplied and registered (regasm), also the COM dll itself must be distributed and registered (regsvr32). Possibly this applies to your situation.

    Armin

    Monday, March 19, 2012 3:41 PM
  • Hi Malhotra,

    We haven’t heard from you for several days. I’d like to mark the helpful replies as answer firstly. If you have any additional questions, you also can unmark the replay and post your question here. 

    Sorry for any inconvenience and have a nice day.


    Mark Liu-lxf [MSFT]
    MSDN Community Support | Feedback to us

    Thursday, March 22, 2012 5:39 AM
    Moderator