4

In Visual Studio 2015 I have a solution with 3 dozens dtsx in the SSIS Packages Folder. I re-build the solution and I get success. Only when I open single dtsx one after the other I notice that some of them (not all), actually, have several problems.

Is there a way to get a list of these problems in the Error List or do I need to open all dtsx one by one?

Hadi
  • 36,233
  • 13
  • 65
  • 124
Johannes Wentu
  • 931
  • 1
  • 14
  • 28

1 Answers1

5

Unfortunately, there is no way to achieve this from your integration services solution (in visual studio) without opening the packages or maybe executing them using DTExec Utility. But you can do some workaround and check get errors programmatically:

Workaround

  1. I created a winforms application using visual studio (using Vb.Net)
  2. I added Microsoft.SqlServer.DTSPipelineWrap and Microsoft.SQLServer.ManagedDTS as references
  3. I used the following code to loop over packages in a specific directory, validate, and get errors into a log file:

    Dim strPackagesDirectory As String = "C:\Users\Admin\Desktop\New folder"
    Dim strOutputLogFile As String = "D:\1.txt"
    
    For Each strFile As String In IO.Directory.GetFiles(strPackagesDirectory, "*.dtsx", IO.SearchOption.TopDirectoryOnly)
    
        Dim pckg As New Microsoft.SqlServer.Dts.Runtime.Package
        Dim app As New Microsoft.SqlServer.Dts.Runtime.Application
    
        pckg = app.LoadPackage(strFile, Nothing)
        Dim obj = pckg.Validate(Nothing, Nothing, Nothing, Nothing)
    
        If pckg.Errors.Count > 0 Then
    
            Using sr As New IO.StreamWriter(strOutputLogFile, True)
                sr.WriteLine("")
                sr.WriteLine(strFile)
                sr.WriteLine("--------------")
                For Each err As Object In pckg.Errors
    
    
                    sr.WriteLine(err.Description)
    
                Next
    
                sr.WriteLine("==========")
                sr.Close()
            End Using
    
        End If
    Next
    

References

Hadi
  • 36,233
  • 13
  • 65
  • 124
  • 1
    it seems there's a missing "next" for the for cycle. This small typo aside, it works very well. It works so well that it is writing errors I can't even see when I directly open the dtsx itself! – Johannes Wentu Mar 06 '17 at 08:00
  • may I ask you what kind of validation errors am I getting from your code? I was expecting to see the same errors that I can notice when I directly open the dtsx. What happens is that I am getting, for almost all dtsx, the same error: The connection "{some guid}" is not found. This error is thrown by Connections collection when the specific connection element is not found. All and only the dtsx with the corresponding CM give this problem... but they are all working correctly! in their code I see this guid is requested but never declared. Why does VS not signal this and why dtsx works OK? – Johannes Wentu Mar 06 '17 at 11:37
  • @JohannesWentu Look like there are parameters that are needed in `Validate` method. I will search for an example – Hadi Mar 06 '17 at 16:03
  • Maybe it is possible to pass the list of connections of my package with the first parameter and the validation process will take them into account – Johannes Wentu Mar 07 '17 at 06:49
  • I managed to get the ConnectionManagerItems of my project and I see the ConnectionManagers (even if they seem to lack a GUID). I can't cast this ConnectionManagersItems to a DTS.Runtime.Connections... it seams sealed and i can't create it – Johannes Wentu Mar 07 '17 at 07:18