0

The following code works in a VB console application, but not in an SSIS script. In SSIS, I get the error "exception has been thrown by the target of an invocation".

I have isolated the error to the JsonConvert step

    Dim jsonText As String
    jsonText = System.IO.File.ReadAllText("F:\user\JDRF APP Track 2\Databases - Development\Carlos Projects\Projects\Bigfoot\data.json")
    jsonText = "{""root"":" & jsonText & "}"
    Dim XMLDoc As Xml.XmlDocument

    ' This is the failing step
    XMLDoc = JsonConvert.DeserializeXmlNode(jsonText)
    XMLDoc.Save("F:\user\JDRF APP Track 2\Databases - Development\Carlos Projects\Projects\Bigfoot\out.xml")

The json references are identical in the console project and the SSIS project: enter image description here

billinkc
  • 59,250
  • 9
  • 102
  • 159
Carlos
  • 1
  • 2
  • Are you running this locally or on a server? Have you installed the newtonsoft.dll in the GAC? – billinkc Feb 18 '16 at 13:27
  • Possibly [of interest](http://stackoverflow.com/questions/11611165/add-third-party-dll-reference-in-ssis-script-component) – billinkc Feb 18 '16 at 13:29
  • I'm running it locally. I can't install anything here, everything is installed by IT folks. Can I assume that if it works in VB that the dll is installed in the GAC? – Carlos Feb 18 '16 at 13:50
  • No, typically JSON.Net gets downloaded through NuGet and placed into the application's bin folder. If your VB application runs and the JSON.Net dll is not in the bin folder, then there's a possibility that it's GAC'd, but most likely that would only have happened if you did it yourself. – Bruce Dunwiddie Feb 18 '16 at 19:38
  • thanks for your help everyone. I can work around it by creating an exe with VB and calling the exe from SSIS. It would be nice to use a script within SSIS but it's not in the cards. – Carlos Feb 22 '16 at 12:40

0 Answers0