Upgrading the Version of a Data Flow Component

New: 5 December 2005

Packages that were created with an older version of your component may contain metadata that is no longer valid, such as custom properties whose usage has been modified in newer versions of the component. You can override the PerformUpgrade method of the PipelineComponent base class to update the metadata previously saved in older packages to reflect the current properties of your component.

The following sample contains code from version 2.0 of a fictitious data flow component. The new version number is defined in the CurrentVersion property of the DtsPipelineComponentAttribute. The component has a property that defines how numeric values that exceed a threshold are to be handled. In prior versions of the fictitious component, this property was named RaiseErrorOnInvalidValue and accepted a Boolean value of true or false. In version 2.0, the property has been renamed to InvalidValueHandling and accepts one of four possible values from a custom enumeration.

The overridden PerformUpgrade method in the following sample performs the following actions:

  • Gets the current version of the component.
  • Gets the value of the old custom property.
  • Removes the old property from the custom property collection.
  • Sets the value of the new custom property based on the value of the old property, if possible.
  • Sets the version metadata to the current version of the component.
The data flow engine passes its own version number into the PerformUpgrade method in the pipelineVersion parameter. This parameter is not useful in version 1.0 of Integration Services, but may become useful in subsequent versions.

The sample code uses only the two enumeration values that map directly to the prior Boolean values for the custom property. Users can select the other available enumeration values through the component's custom user interface, in the Advanced Editor, or programmatically. For information on displaying enumeration values for a custom property in the Advanced Editor, see "Creating Custom Properties" in Design-time Methods of a Data Flow Component.

using System;
using Microsoft.SqlServer.Dts.Pipeline;
using Microsoft.SqlServer.Dts.Pipeline.Wrapper;

[DtsPipelineComponent(ComponentType = ComponentType.Transform, CurrentVersion = 2)]
public class PerformUpgradeCS :

  // Define the set of possible values for the new custom property.
  private enum InvalidValueHandling

  public override void PerformUpgrade(int pipelineVersion)

    // Obtain the current component version from the attribute.
    DtsPipelineComponentAttribute componentAttribute = 
      (DtsPipelineComponentAttribute)Attribute.GetCustomAttribute(this.GetType(), typeof(DtsPipelineComponentAttribute), false);
    int currentVersion = componentAttribute.CurrentVersion;

    // If the component version saved in the package is less than
    //  the current version, Version 2, perform the upgrade.
    if (ComponentMetaData.Version < currentVersion)

    // Get the current value of the old custom property, RaiseErrorOnInvalidValue, 
    // and then remove the property from the custom property collection.
      bool oldValue = false;
        IDTSCustomProperty90 oldProperty = 
        oldValue = (bool)oldProperty.Value;
      catch (Exception ex)
        // If the old custom property is not available, ignore the error.

      // Set the value of the new custom property, InvalidValueHandling,
      //  by using the appropriate enumeration value.
      IDTSCustomProperty90 newProperty = 
      if (oldValue == true)
        newProperty.Value = InvalidValueHandling.FireError;
        newProperty.Value = InvalidValueHandling.Ignore;


    // Update the saved component version metadata to the current version.
    ComponentMetaData.Version = currentVersion;



Community Additions