How do I open a zip file to read in c#

2 posts, 0 answers
  1. Christine
    Christine avatar
    1 posts
    Member since:
    Jul 2017

    Posted 25 Jul 2017 Link to this post

    I am testing a program that downloads a zipped directory that contains text files.  I tried writing a utility that unzips the directory in c# but the version of C# does not support System.IO.Compression.ZipFile.  I would like to be able to unzip the files to read and compare.  Is there a way to read the zipped files without this namespace package?

     

    Here is the example C# code I tried using as an example which does not work because the .ZipFile namespace does not exist.

     

    using System;

    using System.IO;

    using System.IO.Compression;

    ...

    string startPath = @"c:\example\start";

    string zipPath = @"c:\example\result.zip";

    string extractPath = @"c:\example\extract";

    ZipFile.CreateFromDirectory(startPath, zipPath);

    ZipFile.ExtractToDirectory(zipPath, extractPath);

     

     

  2. Nikolai
    Admin
    Nikolai avatar
    106 posts

    Posted 28 Jul 2017 Link to this post

    Hi Christine,

    You can use the .NET 4.0 zip support which is somewhat limited or use Telerik's - ZipArchive implementation part of WPF/WinForms bundle for all zip related tasks.

    Regards,
    Nikolai
    Progress Telerik
     
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
     
Back to Top