Question

I have a VB.Net project which needs to use a third party DLL for which there also an interop assembly. So I have something like this:

Hummingbird.DM.Server.Interop.PCDClient.dll
PCDClient.dll

I tried adding the reference to the interop directly in the project, but on running the file I got a COM not registered error.

So, I tried registering the interop as follows:

gacutil /if "C:\....\Hummingbird.DM.Server.Interop.PCDClient.dll"

regasm "C:\....\Hummingbird.DM.Server.Interop.PCDClient.dll"

Even after restarting VS, the assembly is still not visible.

Was it helpful?

Solution

Your regasm command destroyed the registry keys for the COM server. You'll have to reinstall it. Only use regasm on your own [ComVisible] code.

One reason you may have trouble using the component, beyond it just not having been installed correctly, is because you are trying to run this on a 64-bit operating system. And the component is 32-bit, by far the most common case. You need to force your app to run in 32-bit mode to be able to use it. In the VB.NET IDE, that's done with Project + Properties, Compile tab, scroll down, Advanced Compile Options, set Target CPU to "x86".

The ultimate troubleshooting tool for problems like this is SysInternals' ProcMon utility. It shows you how COM is using the HKLM\Software\Classes\CLSID key to search for the DLL to load.

OTHER TIPS

You're registering the interop, but (as the error message suggests) you've not registered the COM DLL. Try this:

regsvr32 pdcclient.dll
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top