SSIS Execution Failed in C# .net console application - Script tag is corrupt

Chetan Virkar 0 Reputation points
2025-03-27T14:39:45.56+00:00

Hi,

I have create a ssis package in visual studio 2022, in that package I have sql task and script tag.

To execute package I have created .net console application in vs 2022 with following code

string packagePath = @"Path of package";
  Application app = new Application();
  Package package = app.LoadPackage(packagePath, null);
  package.Parameters.Add("DatabaseName", TypeCode.String).Value = "DatabaseName";
  package.Parameters.Add("ServerName", TypeCode.String).Value = "ServerName";
  
  DTSExecResult result = package.Execute();
  Console.WriteLine("Execution Result: " + result.ToString());
  foreach (Microsoft.SqlServer.Dts.Runtime.DtsError local_DtsError in package.Errors)
  {
      string resultado = local_DtsError.Description;
      Console.WriteLine("Execution Result: " + resultado.ToString());
   }

While execution it gives below error.

  1. The Script Task is corrupted.
  2. There were errors during task validation.

SSIS Setting : Deployment Target Version : sql server 2022.

Any tips on where / what to investigate next would be highly appreciated.

Chetan Virkar

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,417 questions
{count} votes

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.