Sunday, July 22, 2018

SSIS Script Task:Error: The Script Task is corrupted.


There are probably a lot of SSIS corruption errors, but that is one that is very easy to solve.

The whole error message is texted like this:
Script Task:Error: The Script Task is corrupted.
Script Task:Error: There were errors during task validation.
Script Task:Error: There was an exception while loading Script Task from XML: System.Exception: The Script Task "ST_74aca886806a416fa34ae89cac6237c2" uses version 15.0 script that is not supported in this release of Integration Services. To run the package, use the Script Task to create a new VSTA script. In most cases, scripts are converted automatically to use a supported version, when you open a SQL Server Integration Services package in %SQL_PRODUCT_SHORT_NAME% Integration Services. at Microsoft.SqlServer.Dts.Tasks.ScriptTask.ScriptTask.LoadFromXML(XmlElement elemProj, IDTSInfoEvents events)

That error came from an execution of SSIS package and it points that particular Script task is corrupted.

It is very confusing, because if you try to run the same package in the Visual Studio everything will be fine:

Just to be short: The error is caused not by corruption during deployment and not by corruption of SSIS DLL library, but just by different version of the compiled code.

Here is how to reproduce that error:
1. Create a package with a Script Task

2. Keep it simple - use C# as a language and click "Edit Script":
3. Enter only one line of a code "int TestVariable = 0;" into the Main section:
4. Then build a solution and deploy it on the SSIS server.
5. On SSIS server execute newly deployed solution:


6. When SSMS asks you want to see a report click "Yes"

7. As the result you will see "Status: Failed". If you click "View Messages" you'll see error details:


Here is how to Fix that problem:
1. In the menu chose Project's properties:

2. In the "Configuration Properties" section you will see TargetServerVersion. In my case it is 2017, while my SQL Server is only at version 2016.
3. The fix is simple: Just specify version of your SQL Server, where you want to deploy that package. Save, re-build/re-compile and re-deploy.

As the result, execution status of your SSIS package has to be "Succeeded":


Hope that post saves you a little time.

6 comments:

  1. Hi,
    this solution does not work for me

    ReplyDelete
  2. Does your package works in VS?
    Have you specified correct version?
    Do you have a similar error?
    If all answers are "Yes", that means the problem is little deeper.

    ReplyDelete
  3. that did the trick for me, thanks Slava

    ReplyDelete
  4. Hello Slava I am facing the same error and followed your steps but I am deploying it to the Azure Managed Instance in SSMS and deploying it to SSISDB Catalog...please suggest me how to deal this script task corrupted issue.

    ReplyDelete
    Replies
    1. Sorry, do not have Azure Managed instance to test it, but in general, look at the versions. Assuming they have to be identical on the instance and in your VS for that task compilation.

      Delete
  5. hi
    this solution is work for me
    thank you

    ReplyDelete