Udostępnij za pośrednictwem


Programming with Primary Interop Assemblies

An interop assembly contains metadata that describes existing COM types. These types are typically already described in a COM type library. The Type Library Importer (Tlbimp.exe) produces interop assemblies from COM type libraries.

Although any developer who wants to use COM types from a .NET Framework application can generate an interop assembly, doing so creates a problem. Each time a developer imports and signs a COM type library, that developer creates a set of unique types that are incompatible with those imported and signed by another developer. The solution to this type incompatibility problem is for each developer to obtain the vendor-supplied and signed primary interop assembly.

If you plan to expose third-party COM types to other applications, always use the primary interop assembly provided by the same publisher as the type library it defines. In addition to providing guaranteed type compatibility, primary interop assemblies are often customized by the vendor to enhance interoperability.

Even if you do not plan to expose third-party COM types, using the primary interop assembly can ease the task of interoperating with COM components. However, this strategy provides no insulation from changes a vendor might make to types defined in a primary interop assembly. When your application requires such insulation, generate your own interop assembly instead of using the primary interop assembly.

See Also

Tasks

How to: Register Primary Interop Assemblies

Concepts

Locating Primary Interop Assemblies

Redistributing Primary Interop Assemblies

Other Resources

Primary Interop Assemblies