Search code examples
sql-serverssisscript-task

Cannot load script for execution


I am getting an error message in VS studios when I try to execute a script task using C# code. The code opens in the editor and will build and rebuild successfully but when I run the package I get

"Cannot load script for execution".

Screenshots

This is the package

Here it builds

This is the error on execution

Output


Solution

  • I figured this out. When you create a new Script task in SSIS there is auto generated code in it that is critical for executing the task. If you take a fully working C# script from a Console application and just ctrl+a, ctrl+v over the entire contents of the SSIS Script task you lose critical parts of the script task code. When this happens, you are left with a script task that will open in the script editor and compile without generating any errors but it will not execute in SSIS.

    Specifically was missing this:

    { [Microsoft.SqlServer.Dts.Tasks.ScriptTask.SSISScriptTaskEntr‌​yPointAttribute] 
    public partial class ScriptMain : 
    Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectM‌​odelBase {