Registering a DTS Custom Task

DTS Programming

DTS Programming

Registering a DTS Custom Task

Data Transformation Services (DTS) custom tasks require entries in their class registration to identify them as DTS tasks. You can add these entries by registering the task from DTS Designer, or you can add code or script to the custom task so that it can create these entries.

In Microsoft® ActiveX® components built with Microsoft Visual Basic®, the registration code is supplied by the build process and is inaccessible to the developer. Therefore, a custom task built with Visual Basic cannot be detected by DTS until it has been registered from within DTS Designer. To create the additional registry entries, you can add code or script to custom tasks built using the Active Template Library (ATL) COM wizards in Microsoft Visual C++®.

DTS Custom Task Registration Entries

In Visual Basic, an ActiveX DLL component containing a public class Component.CTaskClass creates a set of registry keys under \HKEY_CLASSES_ROOT\CLSID\ with this structure:

  • {Class ID for Component.CTaskClass}
    (Default)              Component.CTaskClass
    • Implemented Categories
      • {Automation Objects component category GUID}
    • InprocServer32
      (Default)             path\Component.dll
      Threading Model  Apartment

    • ProgID
      (Default)             Component.CTaskClass

    • Programmable

    • TypeLib
      (Default)             {Component type library GUID}

    • Version
      (Default)              version number

A component with class Component.CTaskClass generated by ATL COM AppWizard in Visual C++ creates a similar set of registry keys under \HKEY_CLASSES_ROOT\CLSID\:

  • {Class ID for Component.CTaskClass}
    (Default)              CTaskClass Class
    • InprocServer32
      (Default)             path\Component.dll
      Threading Model  Both

    • ProgID
      (Default)             Component.CTaskClass.ver

    • Programmable

    • TypeLib
      (Default)             {Component type library GUID}

    • VersionIndependentProgID
      (Default)              Component.CTaskClass

DTS defines a component category for DTS tasks, which is a GUID that is added to the system registry when the Microsoft SQL Server™ client tools are installed on your system. To make a custom task registration visible to DTS Designer, you must add the Implemented Categories key, if it is not already there. Then, add a subkey to Implemented Categories that contains this component category. Optionally, you  can add values to the {Class ID for Component.CTaskClass} key that specify the task icon and default description. The added key and values look like:

  • {Class ID for Component.CTaskClass}
    (Default)                 CTaskClass Class
    DTSIconFile             path\iconfile.ext
    DTSIconIndex          index
    DTSTaskDescription  description
    • Implemented Categories
      • {GUID for DTS Tasks component category}

The added keys, values and data have the following descriptions.

Element Description
path\iconfile.ext File specification of the component that contains icons for the custom task. Typically, this is the component that contains the task, but it can be any file from which icons can be extracted.
index Position of the icon in the list of icons for the custom task. The first icon has index = 0.
description Installed description of the custom task. DTS Designer appends ": undefined" to description to generate the default description when the task icon is dragged to the design sheet.
GUID for DTS Tasks component category GUID that identifies the component as a DTS custom task. The value is defined by the symbol CATID_DTSCustomTask in include file dtspkg.h.

Registry Script File

If you are using the ATL COM wizards to implement a custom task, the simplest way to add these extra keys and values is through the registry script (.rgs) file that ATL Object Wizard generates.

Example

The following registry script was created with the wizard for a custom task class CustTaskOne in a component named DTSSimple. The script in normal font was generated by the wizard. The additional script, in bold, supports the DTS custom task features.

This custom task uses the second icon (offset 1) in the component DLL and the default description is "Simple Custom Task".

Important  Do not use the GUID shown in the example for the DTS tasks component category until you have verified from the dtspkg.h include file on your system that it is correct.

HKCR
{
   DTSSimple.CustTaskOne.1 = s 'CustTaskOne Class'
   {
      CLSID = s '{196617B8-5CE1-4529-B36F-3D8AF026E085}'
   }
   DTSSimple.CustTaskOne = s 'CustTaskOne Class'
   {
      CLSID = s '{196617B8-5CE1-4529-B36F-3D8AF026E085}'
      CurVer = s 'DTSSimple.CustTaskOne.1'
   }
   NoRemove CLSID
   {
      ForceRemove {196617B8-5CE1-4529-B36F-3D8AF026E085} = s 'CustTaskOne Class'
      {
         ProgID = s 'DTSSimple.CustTaskOne.1'
         VersionIndependentProgID = s 'DTSSimple.CustTaskOne'
         ForceRemove 'Programmable'
         InprocServer32 = s '%MODULE%'
         {
            val ThreadingModel = s 'Both'
         }
         'TypeLib' = s '{7852210C-8748-487F-80A7-0FAAB76F0154}'
         'Implemented Categories'
         {
            '{10020200-EB1C-11CF-AE6E-00AA004A34D5}'
         }
         val DTSIconFile = s '%MODULE%'
         val DTSIconIndex = d 1
         val DTSTaskDescription = s 'Simple Custom Task'
      }
   }
}

After you add the script lines for the DTS task, rebuild the project and refresh the DTS cache, if necessary. The custom task appears in DTS Designer without being registered from within DTS Designer.

If you unregister the custom task from within DTS Designer, the unregistration function in DTS Designer will remove the DTS task component category subkey from the registration. To restore the subkey, you need to rebuild the project or reregister the task from the command prompt:

regsvr32 component.dll