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:
- Why the original COM is not listed in COM tab in Add Reference dialog when it's registered via regsvr32?
- Why does VS IDE think that it's not a valid COM when I can invoke it from VBScript and C++ native code?
- What exactly does tlbimp do which the IDE can't do?
- What do I need to read further to improve my understanding of the type libraries and interoperability at play here?