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,593 questions
0 comments No comments
{count} votes

10 answers

Sort by: Most helpful
  1. Elaena Bakman 31 Reputation points
    2021-03-05T19:02:37.847+00:00

    I believe this is a bug. This is what I have done:

    *The first mistake a made was accepting the upgrade from Visual Studio when prompted.

    1. Opened an existing Script Task on a package that was working and has been built and tested.
    2. Click Edit Script.
    3. Changed nothing and just clicked save. Get the following error: Scripts contained in the package have compilation errors. Do you want to save changes? (Remember, I changed nothing!)
    4. Open the script back up by clicking on Edit Script again and go Build and select Build ST_3d9cab1ad210480b84e9145860270c8b (just like it’s recommended here)
    5. The build fails with the following error: Could not find a part of the path 'C:\Users\<User>\AppData\Local\Temp\Vsta\424749ca2d4f4772b6db785f714272fb_out'…
    6. List item

    I have deleted the script and created a new one. I have tried everything recommended here. Having spent quite a bit of time, I believe this is a bug and it drops the binary script and all I can do is just rollback, but I cannot create a new package with a script task because it drops the binary when I modify the script task to add code to it. Can someone from Microsoft please take it seriously and put out a fix. I cannot do my job!

    I have tried to fix it by uninstalling Visual Studio, uninstalling Microsoft.DataTools.IntegrationServices and every sign of Visual Studio ever existing on my machine through the Control Panel. Removed Visual Studio from the registry by adding “_old”.
    Reinstalled Visual Studio and the issue is back. I’ve done it three times now and it doesn’t work! …just telling people to go and Build doesn’t help, it doesn’t build. I compared it to the prior version and I can see that the binary is gone. It's getting removed automatically any time you edit a script task and Build fails.

    0 comments No comments

  2. Phillip Haysom 1 Reputation point
    2021-03-09T14:26:28.76+00:00

    Has there been an update on this? I'm experiencing the same issue. I've uninstalled and re-installed VS2019 and VSTA following an update like the original poster i believe, but i'm still experiencing the same issue.

    Can someone advise the latest/workaround as I cannot do my work!

    Thanks

    0 comments No comments

  3. Marc Sigrist 1 Reputation point
    2021-03-09T21:13:49.887+00:00

    Please note that there is a regression in VS 2019 v 16.9. As a consequence, SSIS Scripts cannot be successfully edited/built any more. See also the announcement on the SQL Server Integration Services Projects extension page:

    There is a regression in VS 2019 16.9 that will cause script task/component not work properly when editing script.

    0 comments No comments

  4. Hrvoje Pejkovic 1 Reputation point
    2021-12-03T10:58:46.25+00:00

    What TodWilliams-9206 wrote worked for me. We migrated from SQL Server version 2017 to SQL Server version 2019. Change version under project properties -> Configuration Properties -> General -> TargetServerVersion, to your new SQL Server version, build again and deploy.

    154775-image.png

    0 comments No comments

  5. Radziej, Devin 1 Reputation point
    2022-09-07T17:29:39.943+00:00

    I have had this issue a few times, each time it has been just long enough for me to forget the solution. Today it happened again so I'm writing it down.

    For me, it had nothing to do with the project itself. It turned out I had added the wrong version of a dll to the server's GAC that was referenced in the vst code. I removed the offending dll from the server, added the correct version, and the "binary code for the script is not found" error stopped occurring when running the package from the catalog.

    Check your references, make sure all external references are added to the server's GAC.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.