We are in the process of updating our SSIS packages from SQL Server 2016 to SQL Server 2019. Many of these packages were developed years ago but others have been created using BIML over the last couple of years. Upon updating the TargetServerVersion from SQL Server 2016 to SQL Server 2019, many of the packages are throwing errors on the Script Components. The errors reference missing directives or assemblies. There are also warnings that refer to the .NET framework being incorrect. This seems to be the primary issue and we see that with the failures the Target framework is stuck on .NET Framework 4.
The error messages are as follows:
The type or namespace name 'ScriptBuffer' could not be found (are you missing a using directive or an assembly reference?).
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.
The warning texts are as follows:
The primary reference "Microsoft.SqlServer.TxScript, Version=15.0.0.0, Culture=Neutral, PublicKeyToken=89845dcd8080cc91" could not be resolved because it has an indirect dependency on the assembly "Microsoft.SqlServer.ManagedDTS, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" which was built against the ".NETFramework,Version=v4.6.2" framework. This is a higher version than the currently targeted framework ".NETFramework, Version=v4.0".
There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "Microsoft.SqlServer.DTSRuntimeWrap, Version=15.0.0.0, Culture=Neutral, PublicKeyToken=89845dcd8080cc91", "x86". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.
We have several developers working on this issue as it impacts over 500 packages. Here is a sample of what we have tried so far:
• Downgrade project TargetServerVersion to 2016 and back to 2019
• Downgrade project TargetServerVersion to 2016 then to 2017 and then to 2019
• Build/rebuild script
• Attempted upgrade in both VS 2017 and VS 2019
• Downgrade project TargetServerVersion to 2012 then to 2016 to 2017 to 2019
• Applied latest updates to VS 2019; removed SSDT and re-added; added in extensions including .NET packages (targeting packs)
• Repaired VSTA
• Attempted upgrade to SQL 2017 in VS 2015
The most pertinent system specifics are below:
Microsoft Visual Studio Community 2019
Version 16.10.3
VisualStudio.16.Release/16.10.3+31424.327
Microsoft .NET Framework
Version 4.7.03190
Installed Version: Community
Microsoft Visual Studio Tools for Applications 2019 00435-60000-00000-AA203
Microsoft Visual Studio Tools for Applications 2019
SQL Server Analysis Services 15.0.19623.0
Microsoft SQL Server Analysis Services Designer
Version 15.0.19623.0
SQL Server Data Tools 16.0.62106.24090
Microsoft SQL Server Data Tools
SQL Server Integration Services 15.0.2000.167
Microsoft SQL Server Integration Services Designer
Version 15.0.2000.167
SQL Server Reporting Services 15.0.19528.0
Microsoft SQL Server Reporting Services Designers
Version 15.0.19528.0
Along with the code in one of the tasks - these are relatively simple scripts:
/* Microsoft SQL Server Integration Services Script Component
* Write scripts using Microsoft Visual C# 2008.
* ScriptMain is the entry point class of the script.*/
using System;
using System.Data;
using Microsoft.SqlServer.Dts.Pipeline.Wrapper;
using Microsoft.SqlServer.Dts.Runtime.Wrapper;
[Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute]
public class ScriptMain : UserComponent
{
private int ETLRowNumber;
public override void PreExecute()
{
base.PreExecute();
ETLRowNumber = 1;
}
public override void Input0_ProcessInputRow(Input0Buffer Row)
{
Row.ETLBatchID = Variables.ETLBatchID;
Row.ETLBatchPackageID = Variables.ETLBatchPackageID;
Row.ETLRowNumber = ETLRowNumber;
ETLRowNumber++;
}
}
We have found references to similar issues and have attempted all of the various suggestions. Ideally, we don’t have to add a new script component to each package and port the code over. This would be a manual effort for the 500+ packages that suffer this same issue.
Here are the links to those similar issues:
[https://learn.microsoft.com/en-us/answers/questions/261916/the-binary-code-for-the-script-is-not-found-vs2019.html][1]
[https://social.msdn.microsoft.com/Forums/sqlserver/en-US/5f0bef4a-c571-4e97-a191-377ea4e3e7f8/ssis-script-component-not-updating-net-framework-after-2012-to-2017-upgrade?forum=sqlintegrationservices][2]
Any help you can provide is much appreciated. Thanks in advance!
I've also attached screenshots of the script properties and errors/warnings.
[115484-package-upgrade-errors.png][3]