I'm trying to programmatically create an 'Excute Package Task' in SSIS using Visual Basic. However I can't get it to work with UseProjectReference = True. The package doesnt fail but nothing happens. Am I missing some other property? Here is the code
Public Sub Main()
Dim ExecResult As DTSExecResult = DTSExecResult.Failure
Dim p As Package = New Package
Dim exec As Executable = p.Executables.Add("STOCK:ExecutePackageTask")
Dim th As TaskHost = CType(exec, TaskHost)
th.Properties("Name").SetValue(th, "Execute Package")
th.Properties("Description").SetValue(th, "Execute Package")
th.Properties("UseProjectReference").SetValue(th, "True")
th.Properties("PackageName").SetValue(th, "Test.dtsx")
th.Properties("ExecuteOutOfProcess").SetValue(th, "False")
ExecResult = p.Execute()
p.Dispose()
Dts.TaskResult = ScriptResults.Success
End Sub
The below code works successfully calling the package from the file system, however as I mentioned I need the package called from the project.
Public Sub Main()
Dim ExecResult As DTSExecResult = DTSExecResult.Failure
Dim SIFISO_app As Application = New Application
Dim p As Package = New Package
Dim cm_DES As ConnectionManager = p.Connections.Add("FILE")
cm_DES.Name = "local_pkg"
cm_DES.ConnectionString = String.Format("C:\Test.dtsx")
Dim exec As Executable = p.Executables.Add("STOCK:ExecutePackageTask")
Dim th As TaskHost = CType(exec, TaskHost)
th.Properties("Name").SetValue(th, "Execute selectSIFISO Package")
th.Properties("Description").SetValue(th, "Execute selectSIFISO Package")
th.Properties("Connection").SetValue(th, "local_pkg")
th.Properties("ExecuteOutOfProcess").SetValue(th, "False")
ExecResult = p.Execute()
p.Dispose()
Dts.TaskResult = ScriptResults.Success
End Sub