Delen via


Producing Primary Interop Assemblies

Primary interop assemblies are provided by the same publisher as the type library they describe and provide the official definitions of the types defined with that type library. Producing and distributing a primary interop assembly is an essential step in exposing COM components to the .NET Framework.

Primary interop assemblies must meet the following requirements:

  • Include all COM types defined in the original type library and maintain the same GUID identities.

  • Be signed with a strong name using standard public key cryptography.

  • Contain the PrimaryInteropAssemblyAttribute attribute.

  • Avoid redefining external COM types.

  • Reference only other primary interop assemblies for external COM dependencies.

Having a single type definition ensures that all .NET Framework applications bind to the same type at compile time, and that the type is marshaled the same way at run time. It is important to create only one primary interop assembly for each COM type library because multiple assemblies can introduce type incompatibility.

To enhance interoperability, you can customize the names and marshaling behavior of individual types. If you revise a primary interop assembly after shipping it, increment the assembly version number to differentiate later versions.

See Also

Concepts

Naming Primary Interop Assemblies

Generating Primary Interop Assemblies

Customizing Primary Interop Assemblies

Distributing Primary Interop Assemblies to Developers

Other Resources

Primary Interop Assemblies