title: SSIS SqlServer 2016 DTS ComponentMetaDataCollection always empty
body: <p>I'm working on creating a .NET program to mass-update a bunch of SSIS packages. I have most of what I need (updating connection strings, changing version, etc.) and the last part I want to do is to be able to programmatically refresh the column metadata. However, I cannot seem to load existing data flow tasks.</p>
  <pre class="lang-cs prettyprint-override"><code>var app = new Microsoft.SqlServer.Dts.Runtime.Application();
  var package = app.LoadPackage(path, null);
  var tasks = package.Executables.Cast&lt;Microsoft.SqlServer.Dts.Runtime.TaskHost&gt;().ToList();
          
  foreach (var item in tasks) {
      var pipeline = item.InnerObject as Microsoft.SqlServer.Dts.Pipeline.Wrapper.Sql2016.MainPipe;
  
      if (pipeline == null) // skip sqltask, sendmailtask, etc
          continue;
  
      var metadata = pipeline.ComponentMetaDataCollection; // always an empty collection
  }
  </code></pre>
  <p>The particaular package I'm loading has multiple tasks, but when I filter to the one that is a data flow task, the <code>ComponentMetaDataCollection</code> is always empty, but I would expect two items (an OLE DB Source and OLE DB Destination).</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;DTS:Executable
    DTS:refId=&quot;Package\WORK&quot;
    DTS:CreationName=&quot;Microsoft.Pipeline&quot;
    DTS:Description=&quot;Data Flow Task&quot;
    DTS:DTSID=&quot;{342AAB75-DE96-47E9-A253-B00B86A56F05}&quot;
    DTS:ExecutableType=&quot;Microsoft.Pipeline&quot;
    DTS:LocaleID=&quot;-1&quot;
    DTS:ObjectName=&quot;WORK&quot;
    DTS:TaskContact=&quot;Performs high-performance data extraction, transformation and loading;Microsoft Corporation; Microsoft SQL Server; (C) 2007 Microsoft Corporation; All Rights Reserved;http://www.microsoft.com/sql/support/default.asp;1&quot;&gt;
    &lt;DTS:Variables /&gt;
    &lt;DTS:ObjectData&gt;
      &lt;pipeline
        version=&quot;1&quot;&gt;
        &lt;components&gt;
          &lt;component
            refId=&quot;Package\WORK\OLE DB Destination&quot;
            componentClassID=&quot;Microsoft.OLEDBDestination&quot;
            contactInfo=&quot;OLE DB Destination;Microsoft Corporation; Microsoft SQL Server; (C) Microsoft Corporation; All Rights Reserved; http://www.microsoft.com/sql/support;4&quot;
            description=&quot;OLE DB Destination&quot;
            name=&quot;OLE DB Destination&quot;
            usesDispositions=&quot;true&quot;
            version=&quot;4&quot;&gt;
  ... edited for brevity 
  </code></pre>
  <p>I've tried dozens of methods over the last two days to try and get the existing ones so that I can refresh the metadata. I know the SqlServer.DTS library is meant more for creating packages rather than modifying existing ones, but is there a way to accomplish this? Ultimately I'm looking to call methods like:</p>
  <pre class="lang-cs prettyprint-override"><code>//foreach (IDTSComponentMetaData100 component in pipeline.ComponentMetaDataCollection) {
  
  //    var wrapper = component.Instantiate();
  //    wrapper.ProvideComponentProperties();
  //    wrapper.AcquireConnections(null);
  //    wrapper.ReinitializeMetaData();
  //    wrapper.ReleaseConnections();
  //}
  </code></pre>
  <p>so I can save myself months' worth of manually updating these (there are something like 3,000 packages in total we need to upgrade). Any help would be greatly appreciated!</p>