When you write code in VB6, the compiled result is a COM component. COM components provide interfaces, co-classes, structures, and enumerations that are typically described using a library of type COM. However, in order to consume this COM component in .NET, you need to enter a type description in a format that .NET understands, that is, the .NET assembly (since it cannot directly work with type libraries). Thus, the interop assembly is simply a βconvertedβ COM-type library in which it contains descriptions of interfaces, structures, etc. Which correspond to the same things in the type library.
(The above is somewhat simplified since the interop assembly does not need to be created from the type library - you can, for example, manually specify the code if you want).
Contrary to what is often said, the interop assembly does not contain executable code, and it does not perform any sorting. It contains only type definitions, and the only place it can have methods is interfaces, and methods on interfaces have no implementation. Marshalling .NET calls for COM packages are actually made by the CLR itself based on type descriptions loaded from interop collectors - it generates all the necessary code on the fly.
Now about your question. You need to register the COM-DLL (the output of your VB6) - for example, using regsvr32.exe . You should not (in fact, you cannot) register the interop assembly in this way, because it is not a COM component - it is just a simple .NET assembly, so you can either put it in the same folder with your .exe / .dll , or put it in the GAC as usual.
Pavel Minaev Nov 04 '09 at 0:12 2009-11-04 00:12
source share