How To Register COM Objects in Visual Studio .NET

Article translations Article translations
Article ID: 307367 - View products that this article applies to.
This article was previously published under Q307367
Expand all | Collapse all

On This Page

SUMMARY

This article explains how to successfully register a COM object in a Visual Studio .NET deployment project.

Steps to Register a COM Module in a Visual Studio .Net Deployment Project

  1. Add a COM object to your Visual Studio deployment project.
  2. In the Solution Explorer, right-click the module that you just added, and then click Properties.

    NOTE: The Properties window contains a table with two columns and x number of rows (the number of rows depends on the project). The left column lists the specific properties. The right column is explained in step 4.
  3. Go to Properties for this module (located by default in the upper-right corner of the .NET Deployment project), and then click Registry property.

    NOTE: The Registry property specifies whether a file, assembly, or project output group should be registered on a target computer during installation.
  4. There is a list box in the right column of the Registry property, which displays several options for you to choose from. Note the following details for an explanation of these options:

      • For assembly, registration is not normally required, and therefore the default is DoNotRegister (this means that the item will not be registered during the installation).

      • For a COM module, you have the options of COM, COMRelativePath, and COMSelfReg. Any one of those three options will register the COM module during the installation.

        Note the following details about each choice:
      1. COM: The module will be registered as a COM object by the Windows Installer engine. The deployment project will update the Class table, ProgID table, and other tables in the Registry Tables group of the corresponding .msi file. This is the recommended way to register a COM module.
      2. COMRelativePath: The module will be registered as an isolated COM object by the Windows Installer engine. Note that this module will be used only by the application that the module is installed with.
      3. COMSelfReg: The installer calls the DllRegisterServer function of that module at the time that you install the module and the DllUnregisterServer function at the time that you uninstall the module. The deployment project will update the SelfReg table of the corresponding .msi file. It is not recommended that the installation package use self-registration. Instead, the installation package should register modules by authoring one or more of the other tables provided by the installer for this purpose (that is, select the COM or COMRelativePath options). Many of the benefits of having a central installer service are lost with self-registration, because self-registration routines tend to hide critical configuration information.

    You can now build your deployment project to allow the preceding modifications to register your COM objects in accordance with the registration property options that you selected in step 4.


REFERENCES


For information about how to deploy .NET applications, browse to the following Microsoft Web site:
http://msdn.microsoft.com/en-us/library/aa720326.aspx

Properties

Article ID: 307367 - Last Review: July 15, 2004 - Revision: 1.2
APPLIES TO
  • Microsoft Visual Studio .NET 2002 Professional Edition
Keywords: 
kbdeployment kbfaq kbhowto kbhowtomaster kbinfo KB307367

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com