Katmai - Script tasks which use the SSIS object model

Katmai - Script tasks which use the SSIS object model

  • Comments 2

 [ Edit: Note, this has been resolve in current Katmai CTPs ]

You may run into issues in the current Katmai CTP if your script task uses objects contained within the ManagedDTS assembly. If you're interested in the details, keep reading - otherwise you can skip to the bottom for a possible work around.

    Public Sub Main()

        Dim childPkgPath As String = "C:\Child.dtsx"

        Dim app As New Application
        Dim pkgChild As Package

        pkgChild = app.LoadPackage(childPkgPath, Nothing)
        pkgChild.Execute()

        If pkgChild.Errors.Count > 0 Then
            Dts.TaskResult = ScriptResults.Failure
        Else
            Dts.TaskResult = ScriptResults.Success
        End If

    End Sub

The above code snippet will give you the following errors:

Error 1 Argument not specified for parameter 'contract' of 'Public Sub New(contract As System.AddIn.Contract.IContract, typeInfrastructureManager As Microsoft.VisualStudio.Tools.Applications.TypeInfrastructureManager)'.

Error 2 Argument not specified for parameter 'typeInfrastructureManager' of 'Public Sub New(contract As System.AddIn.Contract.IContract, typeInfrastructureManager As Microsoft.VisualStudio.Tools.Applications.TypeInfrastructureManager)'.

Compiler errors

The errors come from the proxy classes we created for our VSTA implementation. If you look at references for the project, you'll see that there's no reference to the Microsoft.SqlServer.ManagedDTS assembly. Instead, you'll see our script task proxy - Microsoft.SqlServer.VSTAScriptTaskPrx.

References

Unfortunately, adding the missing reference isn't enough to solve the problem. Because the proxy and the ManagedDTS assembly use the same namespace, it just causes name conflicts.

image

Work Around

Unlike VSA, it's very easy to reference external assemblies in VSTA. Currently the only work around is to compile your script into a custom assembly, and include it from your script task. It's a little messy, but hopefully this is enough of an edge case that not too many people will encounter it. We'll be working on resolving it for an upcoming CTP.

Leave a Comment
  • Please add 5 and 8 and type the answer here:
  • Post
  • I recently loaded CTP6 and the work around described above works as far as loading and executing a package.

    However, I was also manipulating the package variables in my code. How can you access a packages variables from the IDTSPackage100 interface returned from LoadPackage?

  • I had thought CTP6 worked without the workaround - the VSTA proxy classes are now put in a separate namespace, so they no longer conflict. What errors are you getting?

    ~Matt

Page 1 of 1 (2 items)