The binary code for the script is not found | VS2019 | MS SQL Server 2019 64 Bit

Praneeth Pasari 1 Reputation point
2021-02-07T00:49:29.767+00:00

Dear All,

I have some issues with the script task in my Visual studio. Below is the error which I received when I try to run MessageBox.Show("Hello"); in the script task:

Package Validation Error (Package Validation Error)

===================================

Error at Script Task: The binary code for the script is not found. Please open the script in the designer by clicking Edit Script button and make sure it builds successfully.
Error at Script Task: There were errors during task validation.

(Microsoft.DataTransformationServices.VsIntegration)

Things I tried :

  1. Changes the delay validation to True: It didn't worked.
  2. Changed the configuration properties > Target server version to 2019. It didn't worked.

Does some one please be kind to help to resolve the issue of "The binary code for the script is not found." I am struggling from last 2 months on the same issue ?

Thanks in advance

Regards
Irasa

The source code is as follows:

region Help: Introduction to the script task

/* The Script Task allows you to perform virtually any operation that can be accomplished in
* a .Net application within the context of an Integration Services control flow.
*
* Expand the other regions which have "Help" prefixes for examples of specific ways to use
* Integration Services features within this script task. */

endregion

region Namespaces

using System;
using System.Data;
using Microsoft.SqlServer.Dts.Runtime;
using System.Windows.Forms;

endregion

namespace ST_3b3d9705b3e0486cbd54202141ad2378
{
/// <summary>
/// ScriptMain is the entry point class of the script. Do not change the name, attributes,
/// or parent of this class.
/// </summary>
[Microsoft.SqlServer.Dts.Tasks.ScriptTask.SSISScriptTaskEntryPointAttribute]
public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
{
#region Help: Using Integration Services variables and parameters in a script
/* To use a variable in this script, first ensure that the variable has been added to
* either the list contained in the ReadOnlyVariables property or the list contained in
* the ReadWriteVariables property of this script task, according to whether or not your
* code needs to write to the variable. To add the variable, save this script, close this instance of
* Visual Studio, and update the ReadOnlyVariables and
* ReadWriteVariables properties in the Script Transformation Editor window.
* To use a parameter in this script, follow the same steps. Parameters are always read-only.
*
* Example of reading from a variable:
* DateTime startTime = (DateTime) Dts.Variables["System::StartTime"].Value;
*
* Example of writing to a variable:
* Dts.Variables["User::myStringVariable"].Value = "new value";
*
* Example of reading from a package parameter:
* int batchId = (int) Dts.Variables["$Package::batchId"].Value;
*
* Example of reading from a project parameter:
* int batchId = (int) Dts.Variables["$Project::batchId"].Value;
*
* Example of reading from a sensitive project parameter:
* int batchId = (int) Dts.Variables["$Project::batchId"].GetSensitiveValue();
* */

    #endregion

    #region Help:  Firing Integration Services events from a script
    /* This script task can fire events for logging purposes.
     * 
     * Example of firing an error event:
     *  Dts.Events.FireError(18, "Process Values", "Bad value", "", 0);
     * 
     * Example of firing an information event:
     *  Dts.Events.FireInformation(3, "Process Values", "Processing has started", "", 0, ref fireAgain)
     * 
     * Example of firing a warning event:
     *  Dts.Events.FireWarning(14, "Process Values", "No values received for input", "", 0);
     * */
    #endregion

    #region Help:  Using Integration Services connection managers in a script
    /* Some types of connection managers can be used in this script task.  See the topic 
     * "Working with Connection Managers Programatically" for details.
     * 
     * Example of using an ADO.Net connection manager:
     *  object rawConnection = Dts.Connections["Sales DB"].AcquireConnection(Dts.Transaction);
     *  SqlConnection myADONETConnection = (SqlConnection)rawConnection;
     *  //Use the connection in some code here, then release the connection
     *  Dts.Connections["Sales DB"].ReleaseConnection(rawConnection);
     *
     * Example of using a File connection manager
     *  object rawConnection = Dts.Connections["Prices.zip"].AcquireConnection(Dts.Transaction);
     *  string filePath = (string)rawConnection;
     *  //Use the connection in some code here, then release the connection
     *  Dts.Connections["Prices.zip"].ReleaseConnection(rawConnection);
     * */
    #endregion


    /// <summary>
    /// This method is called when this script task executes in the control flow.
    /// Before returning from this method, set the value of Dts.TaskResult to indicate success or failure.
    /// To open Help, press F1.
    /// </summary>
    public void Main()
    {
        // TODO: Add your code here
        MessageBox.Show("Hello");
        Dts.TaskResult = (int)ScriptResults.Success;
    }

    #region ScriptResults declaration
    /// <summary>
    /// This enum provides a convenient shorthand within the scope of this class for setting the
    /// result of the script.
    /// 
    /// This code was generated automatically.
    /// </summary>
    enum ScriptResults
    {
        Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,
        Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
    };
    #endregion

}

}

SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,460 questions
0 comments No comments
{count} votes

10 answers

Sort by: Most helpful
  1. JBrune 6 Reputation points
    2021-05-18T20:46:51.687+00:00

    Upgrading the SSIS component to 13.3.1 fixed this problem for me.

    1 person found this answer helpful.

  2. Todd Williams 6 Reputation points
    2021-10-18T19:11:24.26+00:00

    I was having the same issue using VS 2019 Pro and the latest (as of this writing) SSIS component (3.15). This was an old 2016 project with the destination still set to SQL Server 2016. We upgraded our SQL Server to 2019 (2016 projects still executed fine on the upgraded server), but any attempts to push an updated version of a 2016 project with an SSIS script component would fail with the error reported by Irasa, even though the script successfully reported as being built in the SSIS designer and executed successfully in the designer. What fixed it for me was to change the destination version in the project to SQL Server 2019. Redeploying the same package/script components to SQL Server then worked as expected.

    1 person found this answer helpful.
    0 comments No comments

  3. Yitzhak Khabinsky 25,116 Reputation points
    2021-02-07T07:39:48.703+00:00

    Please open the script in the designer by clicking Edit Script button and make sure it builds successfully.

    Did you do it?

    Please follow the following process after you finished modifying any SSIS Script Task:

    1. Go to the Build menu, and select 2nd option from the top Build ST_<GUID> (Ctrl+B).
    2. Observe that build is successful in the VS Output pane. Along the following lines:
      Build started: Project: ST_6ed65bbae4654154b980936109095fa4
      Build succeeded
    3. Select File => Exit

    This process will make sure that the Script Task was compiled successfully and it is ready to be executed, deployed, etc.

    UPDATE
    It is not clear why the SSIS Script Task is failing for a one single line of code:

    public void Main()
         {
             // TODO: Add your code here
             MessageBox.Show("Hello");
             Dts.TaskResult = (int)ScriptResults.Success;
         }
    

    I would suggest to delete that Script Task and re-create it from scratch.


  4. Praneeth Pasari 1 Reputation point
    2021-02-07T16:53:14.973+00:00

    I tried what you suggested but in the VS output I got "build failed" for basic script task i.e.

    MessageBox.Show("Hello");

    Could you know what might be the reason for the build failed ?


  5. Monalv-MSFT 5,896 Reputation points
    2021-02-09T07:52:21.227+00:00

    Hi @Praneeth Pasari ,

    1.Using Breakpoint options for debugging
    2. Using Logging for the Script Task
    3. Using Try/Catch within Script Task

    The Message Box and Breakpoint options are suitable for design time debugging. The logging and “Try catch” methods are ideal to debug during the run time.

    Please refer to the following links:
    1.SSIS Error: The binary code for the script is not found
    2.Script Task Debugging in SQL Server Integration Services (SSIS)

    Best Regards,
    Mona

    ----------

    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.