Generating Primary Interop Assemblies

There are two ways to generate a primary interop assembly:

  • Using the Type Library Importer (Tlbimp.exe) provided by the Windows Software Development Kit (SDK).

    Producing a primary interop assembly by using Tlbimp.exe to import a type library is straightforward. Tlbimp.exe provides the following safeguards:

    • Checks for other registered primary interop assemblies before creating new interop assemblies for any nested type library references.

    • Fails to emit the primary interop assembly if you do not specify either the container or file name to give the primary interop assembly a strong name.

    • Fails to emit a primary interop assembly if you omit references to dependent assemblies.

    • Fails to emit a primary interop assembly if you add references to dependent assemblies that are not primary interop assemblies.

  • Creating primary interop assemblies manually in source code by using a language that is compliant with the Common Language Specification (CLS), such as C#. This approach is useful when a type library is unavailable.

You must have a cryptographic key pair to sign the assembly with a strong name. For details, see Creating A Key Pair.

See Also

Tasks

How to: Generate Primary Interop Assemblies Using Tlbimp.exe

How to: Create Primary Interop Assemblies Manually

Concepts

Producing Primary Interop Assemblies

Naming Primary Interop Assemblies

Customizing Primary Interop Assemblies

Distributing Primary Interop Assemblies to Developers