locked
How do I create and deploy a SSIS custom task? RRS feed

  • General discussion

  • [This is just for sharing information for those common asked questions collected from forums. If you have any better way or feedback, please directly reply in this thread so that community users can benefit from your answers.]


    Question:
    I want to develop a SSIS custom task. Where should I begin?
     
    Answer:
    Regarding the creation of a SSIS custom task, you can first start with the following article and its related articles:
    Create a Custom Task
    http://msdn.microsoft.com/en-us/library/ms345156.aspx
     
    There is also a good example "HelloWorldTask" in SSIS team blog which you can reference:
    http://blogs.msdn.com/mattm/archive/2008/07/18/creating-a-custom-task-with-a-default-ui.aspx.
     
    To easily deploy your SSIS custom task and use it immediately in your BIDS, you can add the following script to your project's PostBuild event:
    "C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\gacutil.exe" /if "$(TargetPath)"
    copy $(TargetFileName) "C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Tasks"

    In this way, once you build your project, your custom task will be automatically deployed. You can right click the Toolbox in BIDS, click "Choose Items" and select the task at "SSIS Control Flow Items". This article depicts the detailed information:
    Building, Deploying, and Debugging Custom Objects
    http://msdn.microsoft.com/en-us/library/ms403356.aspx
     
    The above articles are for basic knowledge of how to create a SSIS custom task. Sometimes there are some requirements which require your in-depth understanding of SSIS development and .NET  Windows Forms control programming. Another commonly asked question for SSIS custom task is how you can create a property for your custom task, but the property value need to be selected from a dropdown list. The above examples do not show you how to do this. If you do not know about Windows Forms control programming, this may take a lot of time working on this. But if you know it, it will not be a difficult job.
     
    Let us take the HelloWorldTask project for example. To implement this requirement. You need to:
    1.Create a custom type converter class inherited from an existing type converter like StringConverter and override the existing functions. For example:
     

     class DateFormatConverter:StringConverter
    
     {
    
      public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
    
      {
    
       return true;
    
      }
    
     
    
      public override TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
    
      {
    
       return new StandardValuesCollection(new string[] { "yyyy-MM-dd","M/d/yyyy","d/M/yy"});
    
      }
    
     
    
      public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
    
      {
    
       return false;
    
      }
    
     
    
     }
    
    
    
    

     
    2.Define the attribute in the GeneralViewNode class as follows:
               

    [TypeConverter(typeof(DateFormatConverter)), DisplayName("Format"), Description("Display Date Format")]
    
       public string Format
    
       {
    
        get
    
        {
    
         return format;
    
        }
    
        set
    
        {
    
         format = value;
    
        }
    
       }
    
    
    
    

     
    3.Rebuild the project and deploy it. You may need to close your Visual Studio and re-open it so as to use the latest version custom task.
     
    You can read this great article for developing advanced functions for custom task properties:
    Getting the Most Out of the .NET Framework PropertyGrid Control
    http://msdn.microsoft.com/en-us/library/aa302326.aspx


    Please remember to mark the replies as answers if they help and unmark them if they provide no help
    Tuesday, June 22, 2010 1:44 PM