SSIS throwing an error in a script task before the first line of code is reached. Simialr to How can I reference a dll in the GAC from Visual Studio? I did not write it I am just looking at it to see how it works. Is there a rule of thumb of things to look for. It is using a third party library where the orignal code was referencing from the GAC but I am not sure if I installed this 3rd party library into the GAC correctly. So I have referenced the dll direct in the path it was installed into as a first attempt. Like other posts I have read it works fine if I isolate the code into a console app and run it.
Things I have tried so far that work:
- No reference no code other than return success
- With the local reference, no code other than return success
Things I have tried that do not work before I GAC'd:
- kept the Try Catch but one line of code in the try
var session = new Session();
Possible 3rd party library is not same framework version??
Code base: Does a Simple File Transfer Protocol call to send a file to a folder on the destination server. Never gets to the break point if I dont install in the GAC.
Message: Exception has been thrown by the target of an invocation.
Error: at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
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 Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTATaskScriptingEngine.ExecuteScript()
Things I have tried that do not work after I GAC'd:
- I navigated to the v8.0A bin folder and installed my library opening cmd as administrator and cd to the assembly folder and ran gacutil /i "C:\Program Files (x86)\WinSCP\WinSCPNet.dll" and it said successfully installed. I then tried both referencing the library with the same path and also the assembly path C:\Windows\Microsoft.Net\assembly\WinSCP\WinSCPNet.dll" using CopyLocal = False and it works ok debugging locally but once I deploy the SSIS solution the same annoying error "... Target of an invocation ...".