Visual Studio 2005: Create a COM Visible Component

Updated: Friday, March 09, 2007


How To: create a COM visible component in VB2005.

1. Ensure that it's made 'COM visible' (Project Properties -> Application Tab -> Assembly information... button -> 'Make Assembly COM-Visible' option checked).

2. Ensure the class created is COM Visible and a COM Class (both class properties set to true - this will add an attribute to the class automatically.

3. Sign the assembly (Project Properties -> Signing tab -> 'Sign the Assembly' option checked; choose/set a key).

4. Build the assembly.

Then, to register the assembly, use regasm.exe. This is installed with the .net framework by default. Use something like the following (all on a single command line):

c:\windows\microsoft.net\framework\v2.0.50727\regasm.exe
comexpress.dll /tlb:comexpress.tlb /codebase

The assembly will be registered and available for use with any COM Compliant application, such as VB6.

about

name: Stephen J Whiteley
location: Charleston, SC

stuff
Miscellaneous Articles