Error with SharpZipLib in Script Task SSIS 2008can SSIS connect to another sql server?SQL Server 2008 SSIS package compatabilityMS SQL dts to ssis migration errorAccess SSIS Projects Stored in MSDB Database in BIDS?Can SSIS transfer data from a SQL Server 2005 database to a 2008 database?MSSQL: SSIS 2005 transfer logins taskTwo way synchronization with SSIS?SSIS on W2K8 R2, SQL Server 2008 SP2 and OracleHow can I install Data Quality Services on a Denali CTP 3 installation?TFS 2012 and MS SQL 2008r2

How can I ping multiple IP addresses at the same time?

Story of a Witch Boy

What is the "ls" directory in my home directory?

Scaling an object to change its key

What is that ceiling compartment of a Boeing 737?

In a list with unique pairs A, B, how can I sort them so that the last B is the first A in the next pair?

Umlaut character order when sorting

Syntax and semantics of XDV commands (XeTeX)

Is there any possible way to get these hearts as Adult Link?

Can I apply for a working holiday visa at age 30 and get the full 12 months?

Explain why a line can never intersect a plane in exactly two points.

Are intrusions within a foreign embassy considered an act of war?

I just entered the USA without passport control at Atlanta airport

Time at 1 g acceleration to travel 100 000 light years

Unrecognized IC Package Style

First occurrence in the Sixers sequence

What is this airplane that sits in front of Barringer High School in Newark, NJ?

Is declining an undergraduate award which causes me discomfort appropriate?

Can the pre-order traversal of two different trees be the same even though they are different?

What is the highest power supply a Raspberry pi 3 B can handle without getting damaged?

Unable to import binding 'SforceServiceBinding' with the Summer 19 Tooling API WSDL

How to write a nice frame challenge?

I found a password with hashcat but it doesn't work

How does Frenetic Sliver interact with the Unearth from Dregscape Sliver?



Error with SharpZipLib in Script Task SSIS 2008


can SSIS connect to another sql server?SQL Server 2008 SSIS package compatabilityMS SQL dts to ssis migration errorAccess SSIS Projects Stored in MSDB Database in BIDS?Can SSIS transfer data from a SQL Server 2005 database to a 2008 database?MSSQL: SSIS 2005 transfer logins taskTwo way synchronization with SSIS?SSIS on W2K8 R2, SQL Server 2008 SP2 and OracleHow can I install Data Quality Services on a Denali CTP 3 installation?TFS 2012 and MS SQL 2008r2






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I am trying to create a script which can Zip any file on the fly. For this a DLL SharpZipLib i have used. But unable to run the Package. Following code i found on the internet which i have used as is for a sample inside Script Task control.



===========================================



using System;
using System.Data;
using Microsoft.SqlServer.Dts.Runtime;
using System.Windows.Forms;
using ICSharpCode.SharpZipLib.Checksums;
using ICSharpCode.SharpZipLib.Zip;
using ICSharpCode.SharpZipLib.Zip.Compression.Streams;
using ICSharpCode.SharpZipLib.Core;
using System.IO;



public void Main()



 CreateSample("D:\TestZipResult\", "D:\TestZipTarget\"); 

// TODO: Add your code here
Dts.TaskResult = (int)ScriptResults.Success;




// Compresses the files in the nominated folder, and creates a zip file on disk named as outPathname.
//



 public void CreateSample(string outPathname, string folderName)


FileStream fsOut = File.Create(outPathname);
ZipOutputStream zipStream = new ZipOutputStream(fsOut);

zipStream.SetLevel(3); //0-9, 9 being the highest level of compression


// This setting will strip the leading part of the folder path in the entries, to
// make the entries relative to the starting folder.
// To include the full path for each entry up to the drive root, assign folderOffset = 0.
int folderOffset = folderName.Length + (folderName.EndsWith("\") ? 0 : 1);

CompressFolder(folderName, zipStream, folderOffset);

zipStream.IsStreamOwner = true; // Makes the Close also Close the underlying stream
zipStream.Close();



// Recurses down the folder structure
//
private void CompressFolder(string path, ZipOutputStream zipStream, int folderOffset)


string[] files = Directory.GetFiles(path);

foreach (string filename in files)


FileInfo fi = new FileInfo(filename);

string entryName = filename.Substring(folderOffset); // Makes the name in zip based on the folder
entryName = ZipEntry.CleanName(entryName); // Removes drive from name and fixes slash direction
ZipEntry newEntry = new ZipEntry(entryName);
newEntry.DateTime = fi.LastWriteTime; // Note the zip format stores 2 second granularity

// Specifying the AESKeySize triggers AES encryption. Allowable values are 0 (off), 128 or 256.
// newEntry.AESKeySize = 256;

// To permit the zip to be unpacked by built-in extractor in WinXP and Server2003, WinZip 8, Java, and other older code,
// you need to do one of the following: Specify UseZip64.Off, or set the Size.
// If the file may be bigger than 4GB, or you do not need WinXP built-in compatibility, you do not need either,
// but the zip will be in Zip64 format which not all utilities can understand.
// zipStream.UseZip64 = UseZip64.Off;
newEntry.Size = fi.Length;

zipStream.PutNextEntry(newEntry);

// Zip the file in buffered chunks
// the "using" will close the stream even if an exception occurs
byte[] buffer = new byte[4096];
using (FileStream streamReader = File.OpenRead(filename))

StreamUtils.Copy(streamReader, zipStream, buffer);

zipStream.CloseEntry();

string[] folders = Directory.GetDirectories(path);
foreach (string folder in folders)

CompressFolder(folder, zipStream, folderOffset);





===========================================



Following is an error i am getting whereas the reference to DLL is properly added.



===========================================
Error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Could not load file or assembly 'ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf1164f73' or one of its dependencies. The system cannot find the file specified.
File name: 'ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf1164f73'



===========================================



I would be grateful if someone could help me out from this.



Regards,
F. Ahmed










share|improve this question




























    0















    I am trying to create a script which can Zip any file on the fly. For this a DLL SharpZipLib i have used. But unable to run the Package. Following code i found on the internet which i have used as is for a sample inside Script Task control.



    ===========================================



    using System;
    using System.Data;
    using Microsoft.SqlServer.Dts.Runtime;
    using System.Windows.Forms;
    using ICSharpCode.SharpZipLib.Checksums;
    using ICSharpCode.SharpZipLib.Zip;
    using ICSharpCode.SharpZipLib.Zip.Compression.Streams;
    using ICSharpCode.SharpZipLib.Core;
    using System.IO;



    public void Main()



     CreateSample("D:\TestZipResult\", "D:\TestZipTarget\"); 

    // TODO: Add your code here
    Dts.TaskResult = (int)ScriptResults.Success;




    // Compresses the files in the nominated folder, and creates a zip file on disk named as outPathname.
    //



     public void CreateSample(string outPathname, string folderName)


    FileStream fsOut = File.Create(outPathname);
    ZipOutputStream zipStream = new ZipOutputStream(fsOut);

    zipStream.SetLevel(3); //0-9, 9 being the highest level of compression


    // This setting will strip the leading part of the folder path in the entries, to
    // make the entries relative to the starting folder.
    // To include the full path for each entry up to the drive root, assign folderOffset = 0.
    int folderOffset = folderName.Length + (folderName.EndsWith("\") ? 0 : 1);

    CompressFolder(folderName, zipStream, folderOffset);

    zipStream.IsStreamOwner = true; // Makes the Close also Close the underlying stream
    zipStream.Close();



    // Recurses down the folder structure
    //
    private void CompressFolder(string path, ZipOutputStream zipStream, int folderOffset)


    string[] files = Directory.GetFiles(path);

    foreach (string filename in files)


    FileInfo fi = new FileInfo(filename);

    string entryName = filename.Substring(folderOffset); // Makes the name in zip based on the folder
    entryName = ZipEntry.CleanName(entryName); // Removes drive from name and fixes slash direction
    ZipEntry newEntry = new ZipEntry(entryName);
    newEntry.DateTime = fi.LastWriteTime; // Note the zip format stores 2 second granularity

    // Specifying the AESKeySize triggers AES encryption. Allowable values are 0 (off), 128 or 256.
    // newEntry.AESKeySize = 256;

    // To permit the zip to be unpacked by built-in extractor in WinXP and Server2003, WinZip 8, Java, and other older code,
    // you need to do one of the following: Specify UseZip64.Off, or set the Size.
    // If the file may be bigger than 4GB, or you do not need WinXP built-in compatibility, you do not need either,
    // but the zip will be in Zip64 format which not all utilities can understand.
    // zipStream.UseZip64 = UseZip64.Off;
    newEntry.Size = fi.Length;

    zipStream.PutNextEntry(newEntry);

    // Zip the file in buffered chunks
    // the "using" will close the stream even if an exception occurs
    byte[] buffer = new byte[4096];
    using (FileStream streamReader = File.OpenRead(filename))

    StreamUtils.Copy(streamReader, zipStream, buffer);

    zipStream.CloseEntry();

    string[] folders = Directory.GetDirectories(path);
    foreach (string folder in folders)

    CompressFolder(folder, zipStream, folderOffset);





    ===========================================



    Following is an error i am getting whereas the reference to DLL is properly added.



    ===========================================
    Error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Could not load file or assembly 'ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf1164f73' or one of its dependencies. The system cannot find the file specified.
    File name: 'ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf1164f73'



    ===========================================



    I would be grateful if someone could help me out from this.



    Regards,
    F. Ahmed










    share|improve this question
























      0












      0








      0








      I am trying to create a script which can Zip any file on the fly. For this a DLL SharpZipLib i have used. But unable to run the Package. Following code i found on the internet which i have used as is for a sample inside Script Task control.



      ===========================================



      using System;
      using System.Data;
      using Microsoft.SqlServer.Dts.Runtime;
      using System.Windows.Forms;
      using ICSharpCode.SharpZipLib.Checksums;
      using ICSharpCode.SharpZipLib.Zip;
      using ICSharpCode.SharpZipLib.Zip.Compression.Streams;
      using ICSharpCode.SharpZipLib.Core;
      using System.IO;



      public void Main()



       CreateSample("D:\TestZipResult\", "D:\TestZipTarget\"); 

      // TODO: Add your code here
      Dts.TaskResult = (int)ScriptResults.Success;




      // Compresses the files in the nominated folder, and creates a zip file on disk named as outPathname.
      //



       public void CreateSample(string outPathname, string folderName)


      FileStream fsOut = File.Create(outPathname);
      ZipOutputStream zipStream = new ZipOutputStream(fsOut);

      zipStream.SetLevel(3); //0-9, 9 being the highest level of compression


      // This setting will strip the leading part of the folder path in the entries, to
      // make the entries relative to the starting folder.
      // To include the full path for each entry up to the drive root, assign folderOffset = 0.
      int folderOffset = folderName.Length + (folderName.EndsWith("\") ? 0 : 1);

      CompressFolder(folderName, zipStream, folderOffset);

      zipStream.IsStreamOwner = true; // Makes the Close also Close the underlying stream
      zipStream.Close();



      // Recurses down the folder structure
      //
      private void CompressFolder(string path, ZipOutputStream zipStream, int folderOffset)


      string[] files = Directory.GetFiles(path);

      foreach (string filename in files)


      FileInfo fi = new FileInfo(filename);

      string entryName = filename.Substring(folderOffset); // Makes the name in zip based on the folder
      entryName = ZipEntry.CleanName(entryName); // Removes drive from name and fixes slash direction
      ZipEntry newEntry = new ZipEntry(entryName);
      newEntry.DateTime = fi.LastWriteTime; // Note the zip format stores 2 second granularity

      // Specifying the AESKeySize triggers AES encryption. Allowable values are 0 (off), 128 or 256.
      // newEntry.AESKeySize = 256;

      // To permit the zip to be unpacked by built-in extractor in WinXP and Server2003, WinZip 8, Java, and other older code,
      // you need to do one of the following: Specify UseZip64.Off, or set the Size.
      // If the file may be bigger than 4GB, or you do not need WinXP built-in compatibility, you do not need either,
      // but the zip will be in Zip64 format which not all utilities can understand.
      // zipStream.UseZip64 = UseZip64.Off;
      newEntry.Size = fi.Length;

      zipStream.PutNextEntry(newEntry);

      // Zip the file in buffered chunks
      // the "using" will close the stream even if an exception occurs
      byte[] buffer = new byte[4096];
      using (FileStream streamReader = File.OpenRead(filename))

      StreamUtils.Copy(streamReader, zipStream, buffer);

      zipStream.CloseEntry();

      string[] folders = Directory.GetDirectories(path);
      foreach (string folder in folders)

      CompressFolder(folder, zipStream, folderOffset);





      ===========================================



      Following is an error i am getting whereas the reference to DLL is properly added.



      ===========================================
      Error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Could not load file or assembly 'ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf1164f73' or one of its dependencies. The system cannot find the file specified.
      File name: 'ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf1164f73'



      ===========================================



      I would be grateful if someone could help me out from this.



      Regards,
      F. Ahmed










      share|improve this question














      I am trying to create a script which can Zip any file on the fly. For this a DLL SharpZipLib i have used. But unable to run the Package. Following code i found on the internet which i have used as is for a sample inside Script Task control.



      ===========================================



      using System;
      using System.Data;
      using Microsoft.SqlServer.Dts.Runtime;
      using System.Windows.Forms;
      using ICSharpCode.SharpZipLib.Checksums;
      using ICSharpCode.SharpZipLib.Zip;
      using ICSharpCode.SharpZipLib.Zip.Compression.Streams;
      using ICSharpCode.SharpZipLib.Core;
      using System.IO;



      public void Main()



       CreateSample("D:\TestZipResult\", "D:\TestZipTarget\"); 

      // TODO: Add your code here
      Dts.TaskResult = (int)ScriptResults.Success;




      // Compresses the files in the nominated folder, and creates a zip file on disk named as outPathname.
      //



       public void CreateSample(string outPathname, string folderName)


      FileStream fsOut = File.Create(outPathname);
      ZipOutputStream zipStream = new ZipOutputStream(fsOut);

      zipStream.SetLevel(3); //0-9, 9 being the highest level of compression


      // This setting will strip the leading part of the folder path in the entries, to
      // make the entries relative to the starting folder.
      // To include the full path for each entry up to the drive root, assign folderOffset = 0.
      int folderOffset = folderName.Length + (folderName.EndsWith("\") ? 0 : 1);

      CompressFolder(folderName, zipStream, folderOffset);

      zipStream.IsStreamOwner = true; // Makes the Close also Close the underlying stream
      zipStream.Close();



      // Recurses down the folder structure
      //
      private void CompressFolder(string path, ZipOutputStream zipStream, int folderOffset)


      string[] files = Directory.GetFiles(path);

      foreach (string filename in files)


      FileInfo fi = new FileInfo(filename);

      string entryName = filename.Substring(folderOffset); // Makes the name in zip based on the folder
      entryName = ZipEntry.CleanName(entryName); // Removes drive from name and fixes slash direction
      ZipEntry newEntry = new ZipEntry(entryName);
      newEntry.DateTime = fi.LastWriteTime; // Note the zip format stores 2 second granularity

      // Specifying the AESKeySize triggers AES encryption. Allowable values are 0 (off), 128 or 256.
      // newEntry.AESKeySize = 256;

      // To permit the zip to be unpacked by built-in extractor in WinXP and Server2003, WinZip 8, Java, and other older code,
      // you need to do one of the following: Specify UseZip64.Off, or set the Size.
      // If the file may be bigger than 4GB, or you do not need WinXP built-in compatibility, you do not need either,
      // but the zip will be in Zip64 format which not all utilities can understand.
      // zipStream.UseZip64 = UseZip64.Off;
      newEntry.Size = fi.Length;

      zipStream.PutNextEntry(newEntry);

      // Zip the file in buffered chunks
      // the "using" will close the stream even if an exception occurs
      byte[] buffer = new byte[4096];
      using (FileStream streamReader = File.OpenRead(filename))

      StreamUtils.Copy(streamReader, zipStream, buffer);

      zipStream.CloseEntry();

      string[] folders = Directory.GetDirectories(path);
      foreach (string folder in folders)

      CompressFolder(folder, zipStream, folderOffset);





      ===========================================



      Following is an error i am getting whereas the reference to DLL is properly added.



      ===========================================
      Error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Could not load file or assembly 'ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf1164f73' or one of its dependencies. The system cannot find the file specified.
      File name: 'ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf1164f73'



      ===========================================



      I would be grateful if someone could help me out from this.



      Regards,
      F. Ahmed







      sql-server ssis






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Oct 11 '11 at 12:31









      Farhan AhmedFarhan Ahmed

      63




      63




















          1 Answer
          1






          active

          oldest

          votes


















          0














          I am not sure how to do this with SharpZipLib - it looks like there is an issue finding the assembly. Have you tried to GAC the assembly?



          That said, this should be an easy task with the SSIS compression tasks at http://www.nsoftware.com/ssis/.






          share|improve this answer























            Your Answer








            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "2"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f320461%2ferror-with-sharpziplib-in-script-task-ssis-2008%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            I am not sure how to do this with SharpZipLib - it looks like there is an issue finding the assembly. Have you tried to GAC the assembly?



            That said, this should be an easy task with the SSIS compression tasks at http://www.nsoftware.com/ssis/.






            share|improve this answer



























              0














              I am not sure how to do this with SharpZipLib - it looks like there is an issue finding the assembly. Have you tried to GAC the assembly?



              That said, this should be an easy task with the SSIS compression tasks at http://www.nsoftware.com/ssis/.






              share|improve this answer

























                0












                0








                0







                I am not sure how to do this with SharpZipLib - it looks like there is an issue finding the assembly. Have you tried to GAC the assembly?



                That said, this should be an easy task with the SSIS compression tasks at http://www.nsoftware.com/ssis/.






                share|improve this answer













                I am not sure how to do this with SharpZipLib - it looks like there is an issue finding the assembly. Have you tried to GAC the assembly?



                That said, this should be an easy task with the SSIS compression tasks at http://www.nsoftware.com/ssis/.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 16 '11 at 16:42









                EricEric

                1




                1



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Server Fault!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f320461%2ferror-with-sharpziplib-in-script-task-ssis-2008%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Wikipedia:Vital articles Мазмуну Biography - Өмүр баян Philosophy and psychology - Философия жана психология Religion - Дин Social sciences - Коомдук илимдер Language and literature - Тил жана адабият Science - Илим Technology - Технология Arts and recreation - Искусство жана эс алуу History and geography - Тарых жана география Навигация менюсу

                    Bruxelas-Capital Índice Historia | Composición | Situación lingüística | Clima | Cidades irmandadas | Notas | Véxase tamén | Menú de navegacióneO uso das linguas en Bruxelas e a situación do neerlandés"Rexión de Bruxelas Capital"o orixinalSitio da rexiónPáxina de Bruselas no sitio da Oficina de Promoción Turística de Valonia e BruxelasMapa Interactivo da Rexión de Bruxelas-CapitaleeWorldCat332144929079854441105155190212ID28008674080552-90000 0001 0666 3698n94104302ID540940339365017018237

                    What should I write in an apology letter, since I have decided not to join a company after accepting an offer letterShould I keep looking after accepting a job offer?What should I do when I've been verbally told I would get an offer letter, but still haven't gotten one after 4 weeks?Do I accept an offer from a company that I am not likely to join?New job hasn't confirmed starting date and I want to give current employer as much notice as possibleHow should I address my manager in my resignation letter?HR delayed background verification, now jobless as resignedNo email communication after accepting a formal written offer. How should I phrase the call?What should I do if after receiving a verbal offer letter I am informed that my written job offer is put on hold due to some internal issues?Should I inform the current employer that I am about to resign within 1-2 weeks since I have signed the offer letter and waiting for visa?What company will do, if I send their offer letter to another company