none
Remove .COM DLL from Registry RRS feed

  • Question

  • What is the proper way to completely remove COM DLL from the registry?

    I'm experimenting with developing a C# COM Dlls.  I'm calling them from Excel VBA.  I've developed numerous DLLs and for the most part have had great success.  I'd like to remove the DLLs so they don't show in the VBA reference list.  I used Visual Studio Community 2017 to develop them and had VS register them (Properties >> Build >> Register for COM Interop). I use regasm /u mydll.dll to unregister and it says it worked.  But if I look in the registry I see numerous entries for the dll and it still shows in the VBA editor dll references.

    What is the proper way to completely remove COM DLL from the registry?

    Tuesday, February 6, 2018 9:18 PM

All replies

  • You should be able to unregister the DLL and then delete it from the HD. I belive you have to be in the directory of the DLL to unregister it.

    With File Explorer on Windows 10, you can go to the folder and then type in CMD, and it will place you in the directory with the Command Prompt. Maybe some of the other O/S(s) do this too starting with Vista.

    https://technet.microsoft.com/en-us/library/bb490985.aspx?f=255&MSPPError=-2147217396

    Tuesday, February 6, 2018 10:02 PM
  • I use VS to register the COM dll.  It uses regasm to register it not regsvr32.  I know this works but using it to unregister doesn't remove all the registry values it put in when it installed it.  For example it left the aseembly GUID in the registry

    [assembly: Guid("9b06eaab-79c7-4b46-b102-9add1ce8c4c0")]


    • Edited by mogulman52 Wednesday, February 7, 2018 2:22 AM
    Tuesday, February 6, 2018 10:29 PM
  • Problem solved.  There are types of registry keys for a .Net COM Dll. 

    1. Dll related keys

    2. Class related keys

    3. Interface related keys

    Even a simple dll ends up with around 15 entries.

    regasm /u xxxxxxxxxxxx.dll   removes the class registry keys.

    regasm /u /tlb xxxxxxxxxxxxx.dll   removes all the registry keys.  I didn't see this documented anyplace.

    Monday, March 5, 2018 1:23 AM
  • Just an FYI on the terminology. A COM DLL is an unmanaged COM enabled code library. A .NET managed assembly can have COM interfaces but it's not a COM DLL. It's why you use Regasm instead of Regsvr32 to register a .NET assembly for COM Interop.

    Paul ~~~~ Microsoft MVP (Visual Basic)

    Tuesday, March 6, 2018 7:17 PM