Click here to Skip to main content
Click here to Skip to main content

A command line tool to deploy COM components in COM+

, 25 Jan 2008
Rate this:
Please Sign up or sign in to vote.
In a mixed .NET/COM COM+ based environment, one may find a need for a command line tool to deploy COM components in COM+.

Introduction

In a mixed .NET/COM COM+ based environment, one may find a need for a command line tool to deploy COM components in COM+. Such a tool simplifies the deployment of such mixed technologies by allowing a full command line based deployment.

In the good old days of DNA, COM+ components where registered using MSIs. The latter were created using the COM+ export function or other tools like Orca, and included the component DLL(s), their dependencies (other DLLs, TLBs), and the COM+ configuration attributes for the package, components, and interfaces. A typical DNA deployment scenario included a series of MSIs representing multiple COM+ packages, and a master MSI or installation script to bind them all.

.NET [re]introduced the idea of command line deployment. Serviced Components are registered using the framework provided RegSvcs utility. In this scenario, the assembly's dependencies are expected to coexist in the same folder or GAC, and COM+ configuration attributes are annotated inline [code] using EnterpriseServices custom attributes.

The differences noted above make the deployment in a mixed .NET/COM environment challenging: While the .NET serviced components are deployed using a simple command line script, the veteran COM component deployment requires that either MSIs or a series of more complicated VBS scripts (COMAdmin based) are put together. Things become more uncomfortable when you try to utilize a modern [ANT like] deployment tool which tend to like the command line approach over the MSI one.

RegComPlus

The suggested solution in this article is a command line utility [similar to RegSvcs] which allows an easy, one line, registration of COM components in COM+. The lack of inline annotated COM+ configuration attributes in COM based languages like C++ and VB make life a bit more difficult, which is why the utility has two modes:

Basic mode: Designed for inproc (a.k.a. library) packages, using “all default” COM+ configuration.

These are registered in a similar way to how service components are registered using RegSvcs: all you need to specify is the path to the DLL and the package name, and the utility will do the rest.

Example: RegComPlus.exe %binpath%\example.dll ComPlusPackageName >> %logfile%

Advanced mode: Designed for out of process (a.k.a. server) packages, or packages that include multiple DLLs, or packages that require specific configuration of components and/or of interfaces.

Such COM+ packages require additional configuration information that is not accessible to the registration utility; this is where a configuration file comes into play. The configuration file attempts to cover all the desired COM+ attributes otherwise available via the COM+ MMC user interface or the COMAdmin library. More details on the configuration file is available below.

The advantage of using a configuration file vs. COMAdmin based VBS scripts is that the deployment stays simple and easy to maintain: The [more] complex COM+ configuration code is encapsulated in the utility, and changing the desired configuration does not require coding skills. Additionally, once the configuration file is created, the deployment becomes a one [command] liner in a similar way to how serviced components are registered using RegSvcs: all you need to specify is the path to the config file, and the utility will do the rest.

Example: RegComPlus.exe %binpath%\example.config >> %logfile%

The Config File (Advanced Mode)

The config file is XML based. It attempts to cover all the desired COM+ attributes otherwise available via the COM+ MMC user interface or the COMAdmin library. The config file supports installing multiple files in a package and the configuration of all three levels of COM+ objects hierarchy: the package, the components and the interfaces.

The following attributes are supported; do note that partial configuration is supported, and required nodes/attributes are marked as such.

Package (required):

  • name: Package name. Required.
  • isolation: Library/server. Default: library.
  • run_when_idle: true/false. Default: false.
  • queued: true/false. Default: false.
  • queue_listening: true/false. Default: false.

File (at least 1 required):

  • name: File name. Required. Note: if full path is not specified, the file is assumed to exist in the same directory as the config file.

Component (optional):

  • name: Component name. Required. Note: must match component’s ProgID.
  • transactions: 0…4. Default: 3.
    • TransactionIgnored = 0
    • TransactionNone = 1
    • TransactionSupported = 2
    • TransactionRequired = 3
    • TransactionRequiresNew = 4
  • synchronization: 0…4. Default: 2
    • SynchronizationIgnored = 0
    • SynchronizationNone = 1
    • SynchronizationSupported = 2
    • SynchronizationRequired = 3
    • SynchronizationRequiresNew = 4
  • jit: true/false. Default: true.
  • pooled: true/false. Default: true.

Interface (optional):

  • name: Interface name. Required. Note: must match interface’s ProgID.
  • queuing_enabled: true/false. Default: false.

Simple Example:

<configuration>
  <package name="ComPlusPackageName " isolation="server">
    <files>
      <file name="example.dll"/>
    </files>
  </package>
</configuration>

Moderate Example:

<configuration>
  <package name="ComPlusPackageName">
    <files>
      <file name="example.dll"/>
    </files>
    <components>
      <component name="ComPlusComponent1" synchronization="3"/>
      <component name="ComPlusComponent2" 
        transactions="1" synchronization="1" jit="false"/>
    </components>
  </package>
</configuration>

Complex Example:

<configuration>
  <package name="ComPlusPackageName" 
           isolation="server" 
           queued=”true” queue_listening=”true”>
    <files>
      <file name="example.dll"/>
      <file name="c:\mydirectory\example2.dll"/>
    </files>
    <components>
      <component name="ComPlusComponent1" synchronization="3"/>
      <component name="ComPlusComponent2" transactions="1" 
                    synchronization="1" jit="false"/>
      <component name="ComPlusComponent3" transactions="4"/>
      <component name="ComPlusComponent4">
          <interface name="ComPlusInterface4" queuing_enabled=”true”>
      </component>
    </components>
  </package>
</configuration>

Technology

The RegComPlus utility was coded in C#, and utilizes the COMAdmin library over System.Runtime.InteropServices.

Additional Reading

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Tomer Doron
Architect
United States United States
Technologist & Executive.
 
Specializes in .NET, COM and the gray material between them. Intimately familiar with most MS technologies.
 
Developing software for a living for the last 10 years, focusing on web based enterprise software as a service for the last 8.

Comments and Discussions

 
Questionfurther customizations in xml files PinmemberGianluca724-Jul-14 2:43 
QuestionRegcomPlus.exe PinmemberMember 92299909-Jul-12 5:17 
QuestionVB Component ? Pinmemberopenpage5-Mar-11 19:26 
QuestionQuestion in Regcomplus.exe utlity PinmemberSimon Mandy19-Mar-10 8:39 
QuestionUser for com+ component PinmemberTrug2-Sep-09 2:44 
AnswerRe: User for com+ component PinmemberRajesh_BS4-Nov-10 2:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web01 | 2.8.140721.1 | Last Updated 25 Jan 2008
Article Copyright 2008 by Tomer Doron
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid