Click here to Skip to main content
6,292,426 members and growing! (10,589 online)
Email Password   helpLost your password?
Platforms, Frameworks & Libraries » COM / COM+ » Tools     Intermediate License: The Code Project Open License (CPOL)

A command line tool to deploy COM components in COM+

By Tomer Doron

In a mixed .NET/COM COM+ based environment, one may find a need for a command line tool to deploy COM components in COM+.
C++, C#, VB, XML, Windows, COM, COM+, Dev
Posted:25 Jan 2008
Views:8,390
Bookmarked:7 times
Announcements
Loading...
 
Search    
Advanced Search
printPrint   Broken Article?Report       add Share
  Discuss Discuss   Recommend Article Email
4 votes for this article.
Popularity: 2.03 Rating: 3.36 out of 5
1 vote, 25.0%
1

2

3
1 vote, 25.0%
4
2 votes, 50.0%
5

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


Member
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.
Occupation: Architect
Location: United States United States

Other popular COM / COM+ articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
  (Refresh) 
-- There are no messages in this forum --

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 25 Jan 2008
Editor: Smitha Vijayan
Copyright 2008 by Tomer Doron
Everything else Copyright © CodeProject, 1999-2009
Web19 | Advertise on the Code Project