question

PraneethPasari-8778 avatar image
0 Votes"
PraneethPasari-8778 asked ·

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

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
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

YitzhakKhabinsky-0887 avatar image
0 Votes"
YitzhakKhabinsky-0887 answered ·

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.

· 2 ·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I tried deleting the script task and create again many times and I even tried to uninstall all the instance of VS, SSIS and MS SQL from the computer and reinstalled it but still its not working.. Its being almost two months I am trying to find the solution for this error.

0 Votes 0 ·

Please connect with me on LinkedIn.

0 Votes 0 ·
PraneethPasari-8778 avatar image
0 Votes"
PraneethPasari-8778 answered ·

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 ?

· 2 ·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Please edit your original question and add the entire source code for the Main() method.
If it is possible, please share a line that it failing too.

0 Votes 0 ·

I updated the answer.
Please check its UPDATE section.

0 Votes 0 ·
Monalv-msft avatar image
0 Votes"
Monalv-msft answered ·

Hi @PraneethPasari-8778 ,

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.

· 3 ·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @PraneethPasari-8778 ,

May I know if you have anything to update?

Best Regards,
Mona

0 Votes 0 ·

Dear @Monalv-msft,

I tried what you suggested but It didn't work. I was getting the same error when I applied breakpoint and performed the debugging. I got the same error. when I tried to go the specific error I am getting an error saying " failed to navigate to the source". I got prompt as shown in the screenshot.

Other than that I tired the following based on the feedback of @YitzhakKhabinsky-0887

  • Repairing the VS, SSIS and SQL server and make sure all updates are finished in the windows OS.

  • Added latest .Net Framework and repaired it.

then also I am still getting the same error. The only thing left to do is reboot the windows OS or reinstalling the OS in the laptop. If you have any other solutions happy to try them off too.

67764-error-binary.jpg





0 Votes 0 ·
error-binary.jpg (155.0 KiB)
Monalv-msft avatar image Monalv-msft PraneethPasari-8778 ·

Hi @PraneethPasari-8778 ,

Please back up the script in Script Task and then delete the old Script Task and create new Script Task.

Best Regards,
Mona

0 Votes 0 ·
ElaenaBakman-4685 avatar image
0 Votes"
ElaenaBakman-4685 answered ·

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.

·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

PhillipHaysom-9215 avatar image
0 Votes"
PhillipHaysom-9215 answered ·

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

·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

MarcSigrist-0200 avatar image
0 Votes"
MarcSigrist-0200 answered ·

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.



·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.