Getting error in Script task in SSIS

  • Hi Friends,

    I am getting this error while executing an SSIS package:

    The task is configured to pre-compile the script, but binary code is not found. Please visit the IDE in Script Task Editor by clicking Design Script button to cause binary code to be generated.

    I may be getting this error due to some incorrect code in the Design script. However, the same code works in one of the server but does'nt on the other one.

    In the design script I get a type not defined error in some the statements:

    for e.g.- type 'Zip entry 'is not defined

    Could someone please help me in this regard ?

    Thanks a lot in advance for your help

  • Can you please post your script code so that we can see what it is you are trying to do? Thanks.

  • Hello Justin,

    Really very sorry for the late reply. Below is the code for unzipping the file I am using in SSIS:

    Imports System

    Imports System.Data

    Imports System.Math

    Imports Microsoft.SqlServer.Dts.Runtime

    Imports java.io.FileInputStream

    Imports java.io.FileOutputStream

    Imports java.util.zip.ZipInputStream

    Imports java.util.zip.ZipOutputStream

    Imports java.util.zip

    Imports java.io

    Public Class ScriptMain

    ' The execution engine calls this method when the task executes.

    ' To access the object model, use the Dts object. Connections, variables, events,

    ' and logging features are available as static members of the Dts class.

    Public Sub Main()

    Try

    Dim strSourceFile As String

    Dim strDestinationDirectory As String

    strSourceFile = "C:\Visio2020Upload\" & Dts.Variables("file").Value.ToString()

    strDestinationDirectory = "C:\Visio2020Upload\"

    Dim oFileInputStream As New java.io.FileInputStream(strSourceFile)

    Dim oZipInputStream As New java.util.zip.ZipInputStream(oFileInputStream)

    Dim bTrue As Boolean = True

    Dim sbBuf(1024) As SByte

    While 1 = 1

    Dim oZipEntry As ZipEntry = oZipInputStream.getNextEntry()

    If oZipEntry Is Nothing Then Exit While

    If oZipEntry.isDirectory Then

    If Not My.Computer.FileSystem.DirectoryExists(strDestinationDirectory & oZipEntry.getName) Then

    My.Computer.FileSystem.CreateDirectory(strDestinationDirectory & oZipEntry.getName)

    End If

    Else

    Dim oFileOutputStream As New java.io.FileOutputStream(strDestinationDirectory.Replace("\", "/") & oZipEntry.getName())

    While 1 = 1

    Dim iLen As Integer = oZipInputStream.read(sbBuf)

    If iLen < 0 Then Exit While

    oFileOutputStream.write(sbBuf, 0, iLen)

    End While

    oFileOutputStream.close()

    End If

    End While

    oZipInputStream.close()

    oFileInputStream.close()

    Catch ex As Exception

    Throw New Exception(ex.Message)

    End Try

    End Sub

    End Class

    Thanks in advance for your help.

    Cheers !

    Paul

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply