Exception has been thrown by the target of an invocation

This is just a high-level exception. The root cause is usually stored in the InnerException.

If you are getting this exception in SSIS, you can use trycatch block to capture the error, as show in the example for using WinSCP .NET Assembly from SSIS.

If you cannot access the inner exception easily, inspect WinSCP session log and debug log file (Session.SessionLogPath, Session.DebugLogPath). If those file are not even created, the root cause can be loading of WinSCPnet.dll assembly. See Could not load file or assembly 'file:///...\WinSCPnet.dll' or one of its dependencies. The system cannot find the file specified..

Last modified: by martin