Поделиться через


Deploying an Interop Application

An interop application typically includes a .NET client assembly, one or more interop assemblies representing distinct COM type libraries, and one or more registered COM components. The .NET Framework SDK provides tools to import and convert a type library to an interop assembly. You must ship the interop assembly with the other assemblies that make up your application.

Assemblies can have strong names. A strong-named assembly includes the publisher's public key, which provides a unique identity. Assemblies produced by the Type Library Importer (Tlbimp.exe) can be signed by the publisher using the /keyfile option. You can install signed assemblies into the global assembly cache. Unsigned assemblies must be installed on the user's machine as private assemblies.

Private Assemblies

To install an assembly to be used privately, both the application EXE and the interop assembly containing imported COM types must be installed in the same directory structure. The following illustration shows an unsigned interop assembly to be used privately by Client1.exe and Client2.exe, which reside in separate application directories. The interop assembly, which is called LOANLib.dll in this example, is installed twice.

Directory structure and registry entries for a private deployment

All COM components associated with the application must be installed in the Windows registry. If Client1.exe and Client2.exe in the illustration are installed on different computers, you must register the COM components on both computers.

Shared Assemblies

Assemblies shared by multiple applications should be installed in a centralized repository called the global assembly cache. .NET clients can access the same copy of the interop assembly, which is signed and installed in the global assembly cache.

See Also

Exposing COM Components to the .NET Framework | Importing a Type Library as an Assembly | Using COM Types in Managed Code | Compiling an Interop Project