Assemblies created with the .NET Framework

You can use the COM interoperability features of the Microsoft .NET Framework to make the classes, properties and methods in a .NET assembly available through COM. This allows applications that support COM, such as Dexterity, to access the functionality available in these assemblies. To make your .NET assemblies available through COM, do the following:

  1. Specify the items to be accessed through COM.

In the code for your assembly, you must properly structure and qualify your classes, methods, and properties to have them be accessible through COM. For assemblies created in C#, you must include a reference to the InteropServices namespace.

using System.Runtime.InteropServices;

Use attributes to specify the items you want to be accessible through COM. For example, the following attribute indicates that the Customer class will be available through COM.

[ClassInterface(ClassInterfaceType.AutoDual)]
public class Customer {
...
}

Your code must follow other guidelines for your assemblies to be accessible from COM. Refer to the .NET Framework documentation for more information about COM interoperability.


  1. Build the assembly.

The attributes you added to your code will indicate which classes, methods, and properties that will be available through COM.

  1. Register the assembly.

Use the REGASM.EXE application to register all of the public classes in the assembly. For example, the following command registers the Customer.dll assembly.

regasm Customer.dll

  1. Create the registry file for the assembly.

Using the REGASM.EXE application, create a .reg file that describes the assembly. This file must be merged into the registry on your system. The following command creates the .reg file for the Customer assembly.

regasm Customer.dll /regfile:Customer.reg

  1. Create the type library for the assembly.

Using the REGASM.EXE application, create .tlb file that contains the definitions of the public types in the assembly. The following command creates the .tlb for the Customer assembly.

regasm Customer.dll /tlb:Customer.tlb

This is the type library you will reference from within Dexterity to access the capabilities made available through COM.

The GUIDs in the registry (.reg) file and the .NET assembly must match for the .NET assembly to be accessed. Be sure the .reg file is generated for the assembly you are deploying.


When your application accesses the assembly you created with .NET, the assembly should be located in the same directory as Dexterity or the Runtime engine. Another option is to be sure the assembly is strongly-named, so it can be added to the global assembly cache (GAC) where it can be located by any application accessing it through COM.

To deploy the .NET assembly with your Dexterity-based application, you must ship both the .NET assembly and the .reg file. It is not necessary to ship the .tlb file. On the target system, the .reg file must be run so that its registry entries it contains are added to the system on which the application is being run.

 


Documentation Feedback