Hi, I am encountering the same issue, in a similar environment. I followed your suggestion prikryl, but it isn't illuminating for me what is wrong. This is the full exception:
Error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Could not load file or assembly 'WinSCPnet, Version=1.1.4.3970, Culture=neutral, PublicKeyToken=2271ec4a3c56d0bf' or one of its dependencies. The system cannot find the file specified.
File name: 'WinSCPnet, Version=1.1.4.3970, Culture=neutral, PublicKeyToken=2271ec4a3c56d0bf'
at ST_c8729c8a88144f1cb830af581ce9e217.csproj.ScriptMain.Main()
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
Running under executable c:\Program Files (x86)\Microsoft SQL Server\100\DTS\binn\DtsDebugHost.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = anub
LOG: DisplayName = WinSCPnet, Version=1.1.4.3970, Culture=neutral, PublicKeyToken=2271ec4a3c56d0bf
(Fully-specified)
LOG: Appbase = file:///c:/Program Files (x86)/Microsoft SQL Server/100/DTS/binn/
LOG: Initial PrivatePath = NULL
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: c:\Program Files (x86)\Microsoft SQL Server\100\DTS\binn\DtsDebugHost.exe.Config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Post-policy reference: WinSCPnet, Version=1.1.4.3970, Culture=neutral, PublicKeyToken=2271ec4a3c56d0bf
LOG: Attempting download of new URL file:///c:/Program Files (x86)/Microsoft SQL Server/100/DTS/binn/WinSCPnet.DLL.
LOG: Attempting download of new URL file:///c:/Program Files (x86)/Microsoft SQL Server/100/DTS/binn/WinSCPnet/WinSCPnet.DLL.
LOG: Attempting download of new URL file:///c:/Program Files (x86)/Microsoft SQL Server/100/DTS/binn/WinSCPnet.EXE.
LOG: Attempting download of new URL file:///c:/Program Files (x86)/Microsoft SQL Server/100/DTS/binn/WinSCPnet/WinSCPnet.EXE.
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, CultureInfo culture)
at Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTATaskScriptingEngine.ExecuteScript()
I get this is an esoteric issue, with SSIS being what it is, but any guidance would be greatly appreciated. I'm stuck. WinSCP is in Microsoft SQL Server/100/DTS/Binn/ and Program Files (x86)/WinSCP/ and my script task is Using WinSCP; and has a reference to the dll contained in Program Files (x86)/WinSCP/.