user3613834
user3613834

Reputation: 71

"The binary code for the script is not found"

I used the script found here

... And every time that I generate this dynamic package, it needs to open the script task and click "Ok" because the "The binary code for the script is not found." error aways appears. Is there a way to solve this without BIDS ? Thanks and sorry my bad english.

Upvotes: 7

Views: 54912

Answers (13)

YeinCM-Qva
YeinCM-Qva

Reputation: 131

Maybe, still, this could help someone in case they went over a similar problem. We ran over the same error it was just running fine from Visual Studio 2015 local machine targeting .Net v4.0 in the scripts, and after deploying to a MSS Enterprise:

enter image description here

the failure showed up basically with same similar error message ("Description: 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" and "Script Component" failed validation and returned validation status "VS_ISBROKEN") when executing SSIS from sql job task like this:

enter image description here

I had some other scripts executing just fine inside other Data Flow tasks but this new one started failing and applied some fixes I found in this same post to the .Net code internally in the script including the string concatenation change previously mentioned by Crispy and Ahsan Umair answers in this same thread, error continued so I also had to replace a portion of my code where I was using Reflection to avoid extra code as follows:

            for (int i = 1; i <= 10; i++)
            {
                string index = i.ToString("D2"); // Format the number to two digits
                string fieldValue = row[$"FieldName" + index].ToString();
                typeof(OutputBuffer).GetProperty($"FieldName" + index).SetValue(OutputBuffer, fieldValue, null);
            }

we replaced it with:

OutputBuffer.FieldName01 = row["FieldName01"].ToString();
OutputBuffer.FieldName02 = row["FieldName02"].ToString();

.... etc until FieldName10

And after compiling and saving the script and redeploying SSIS to SQL server it just worked. So just for you to have it present, that some codings of the .Net v4.0 may not be successfully executing at run time in server side.

Upvotes: 0

icastel
icastel

Reputation: 1

We went from SQL Server 2016 to 2017. The migrated package worked well initially, but when I tried to edit the script component, everything seemed to be normal and ran on my local machine, BUT it did not run on the server. I kept getting the dreaded "The binary code for the script is not found. Please open the script in the designer by clicking the Edit Script button and make sure it builds successfully." The SSIS package contains a single script component used for data staging. I use VS 2019.

I tried all the fixes above and a few others I found elsewhere. No luck.

What finally seems to have worked for me was to open the SSIS project's properties (not the script's, but the SSIS package's) and change the target SQL Server to 2017 because it was still set to 2016.

Once I changed the target, I rebuilt and redeployed. This fixed the problem!

Upvotes: 0

Ahsan Umair
Ahsan Umair

Reputation: 21

This error can happen if you are using C# language features in the script task within SSIS package which are not currently supported by C# language version for that package. For example, any SSIS packages targeting SQL 2012 you should only use C# language features which target .Net Framework 4.

For example, package will fail to execute within SQL server if new syntax for string concatenation used within script task instead of old way.

i.e used syntax "Found {count} rows" instead of "Found" + count + "rows". so please check if you are not using any language features which are not currently supported.

Please note that if you are using unsupported language features in script task, the SSIS package would execute correctly within Visual Studio but would fail to execute when deployed on SQL Server.

If SSIS package has been upgraded to SQL 2019 or higher, then new C# language features can be used as well. Hope this helps.

Upvotes: 2

p sharif
p sharif

Reputation: 1

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

For adding your dll(for example csvhelper.dll) in GAC you can use the following command in cmd.

C:\test>"C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.7 Tools\gacutil.exe" -i csvhelper.dll

**Put your dll in a folder (for example in test folder)

**Pay attention which version of .Netframework you have(Here I used .net4.7)

Upvotes: 0

Jayesh Naik
Jayesh Naik

Reputation: 21

This worked for us

  • From Project properties, change TargetServerVersion to SQL Server 2019 (Or desired version)

  • open the .dtsx file for each package in Notepad++ or other text editor

  • remove the following for each dtsx file (there will be 1 occurence per script component in packages)

    <PropertyGroup>
            <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
    </PropertyGroup>
    
  • save the .dtsx file

  • go back into Visual Studio and rebuild the project file (as well rebuild individual script task)

Upvotes: 2

user2480117
user2480117

Reputation: 51

After changing from VS 2017 to VS 2019, I saw this error in SQL Server / Integration Services Catalog / "My Package" / Validate... These messages are also visible in Standard Reports / All Executions.

My particular error messages were "VS_ISBROKEN" in the SSIS.Pipeline and "The binary code for the script is not found." in my scripting task.

I opened up the scripting task (C#) and changed the project target to x86 instead of None (MSIL), rebuilt it, closed the scripting solution, pressed Ok to keep the script changes, saved, built and deployed.

That worked for me.


Addendum: It turns out that I was deploying a single package using VS2019 while the original Project was deployed using VS2017.

I think that the two deployments are not 100% compatible, and recommend that users either deploy an entire project, or deploy a package update using the same version as was used for the initial release.

You should probably ignore my suggestion above about changing project target.

Upvotes: 0

Crispy
Crispy

Reputation: 5637

For me, I found that using string interpolation caused the issue.

For example: This line caused the error:

command += $"test {property.Name}";

Changing it to this fixed the error:

command += "test " + property.Name;

Upvotes: 1

user13093616
user13093616

Reputation: 1

use SSMS V17.8.1 and upgrade your SSISDB and it will work, I tried it.

Upvotes: 0

user2772063
user2772063

Reputation: 1

Uninstall VS 2015 and SSDT 14. Re Install VS 2015 and SSDT 14. Open a new Integration project and import the SSIS project using the ispac file Open the task having the error Click On Edit Script. Then either do this: In Build tab click on Run code analysis on solution or Build or Clean and then Build Save All the solution Close the window Click on OK in the task window.

OR just click on edit script and then OK button The error should go off

This is for Visual Studio 2015 Community/SSDT 14

Upvotes: 0

George Maxson
George Maxson

Reputation: 1

In Visual Studio 2017, SSIS 2017 solution, had same error on a script task. Compared to another solution with similar process and discovered the issue was the Reference which had an error did not have a path listed for the dll. Removed the reference and added again. This resolved the issues.

Upvotes: 0

Mercum
Mercum

Reputation: 1

I just ran into this error, after I changed my package deployment configuration to 2012. In the script some references we no longer linked. I had to reset the version of the .Net framework in the VS script environment, references were now legit, rebuild success.

Upvotes: 0

Sam
Sam

Reputation: 7678

I got this error when a SSISDB was upgraded to 2016 from 2012 and the package was not re-deployed using newer visual studio with project set to deploy to SQL Server 2016 in the project deployment properties.

Upvotes: 6

Anthony Horne
Anthony Horne

Reputation: 2522

This is often caused to to an error or omission in the code in the script task. If you are certain that the code is correct you can go to the script properties and set the PrecompileiIntoBindaryCode to False, the default is set to true. This is under the Properties or in the Script option of the properties window.

Upvotes: 2

Related Questions