//other references and namespace excluded for sake of space
public void Main()
var process = new LoadProcess();
Dts.TaskResult = (int)ScriptResults.Success;
catch (Exception ex)
Dts.TaskResult = (int)ScriptResults.Failure;
After a lot of testing I found that this error is caused due to the script component's inability to reach the DLL being referenced. The error: "Exception has been thrown by the target of an invocation" is thrown when one of the references in the script in unable to be found such as a file does not exist error or a library not found.
This is because the location of the script components is stored in a separate location than the actual solution of the SSIS package making the DLLs unreachable. I hope this helps!