Creating a Zip Folder using C#
<p>I am trying to create a zip folder with some files in it by getting the path from the server and using the vjslib.dll library </p>

<p>The code fails at  <code>ZipOutputStream outf = new ZipOutputStream(new FileOutputStream(outFilename));</code></p>

<p>The error i get <strong>A first chance exception of type 'System.TypeInitializationException' occurred in vjslib.dll</strong>      </p>

<pre><code>using System;
    using System.Data;
    using Microsoft.SqlServer.Dts.Runtime;
    using System.Windows.Forms;
    using System.IO;
    using java.util.zip;
    using java.io;

    namespace s1.csproj
    {
        [Microsoft.SqlServer.Dts.Tasks.ScriptTask.SSISScriptTaskEntryPointAttribute]
        public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
        {


            enum ScriptResults
            {
                Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,
                Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
            };




            public void Main()
            {
                try
                {
                    ZipFiles();
                    Dts.TaskResult = (int)ScriptResults.Success;
                }
                catch
                {
                    Dts.TaskResult = (int)ScriptResults.Failure;
                }

            }

            public void ZipFiles()
            {
                string xlsFileName = Dts.Variables["User::ZipFileMask"].Value.ToString();
                string ZipFileName = Dts.Variables["User::ZipFileName"].Value.ToString();
                string ZipFilePath = Dts.Variables["User::ZipFilePath"].Value.ToString();

                //Delete the zip file
                if (System.IO.File.Exists(ZipFilePath + ZipFileName))
                    System.IO.File.Delete(ZipFilePath + ZipFileName);

                string FilePath = Dts.Variables["User::ZipFilePath"].Value.ToString() ;

                // These are the files to include in the ZIP file            
                string[] FileNames = Directory.GetFiles(FilePath, xlsFileName);

                // Create a buffer for reading the files
                sbyte[] buff = new sbyte[1024];

                try
                {
                    // Create the ZIP file
                    String outFilename = ZipFilePath + ZipFileName;
                    ZipOutputStream outf = new ZipOutputStream(new FileOutputStream(outFilename));


                    // Compress the files
                    for (int i = 0; i &lt; FileNames.Length; i++)
                    {
                        string strsourcefile = FileNames[i];
                        FileInputStream inx = new FileInputStream(strsourcefile);
                        string filename = Path.GetFileName(FileNames[i]);
                        string strzipentry = filename;
                        ZipEntry ze = new ZipEntry(strzipentry);
                        outf.putNextEntry(ze);
                        sbyte[] buffer = new sbyte[1024];
                        int len;

                        while ((len = inx.read(buff)) &gt; 0)
                        {
                            outf.write(buff, 0, len);
                        }

                        outf.closeEntry();
                        inx.close();

                    }
                    outf.close();
                }
                catch
                {
                    throw;
                }
            }


        }
    }
</code></pre>