I have a COM DLL written in unmanged C++, and compiled with VS 2010. I can register the DLL using regsvr32 and I can invoke it via VBscript.
When I try to add a reference to it, while creating a C# client, I don't see the COM object listed in Add Reference -> COM tab. If I manually browse to the DLL and try to select it, it says that the DLL is not a valid assemlby or COM component.
Now, I can use tlbimp tool to generate an interop DLL and use that to add as a reference to my C# client. And everything works fine.
My questions are:
Looks like a typelib issue -- your COM classes may be have been registered correctly, but your typelib probably is not. Maybe you forgot to invoke RegisterTypeLib from within your DllRegisterServer function?
Referring to your questions:
The dialog looks for registered typelibs, not for COM classes
VBscript invokes IDispatch and does not care about typelibs. tlbimp does not care about IDispatch and requires a typelib
You passed the DLL name to tlbimp -- so tlbimp knew how to get hold of the typelib. VS, in contrast, refers to the registry which lacks the approriate registration data