none
System.IO.Compression.FileSystem RRS feed

  • Question

  • Hi so I am really new to coding with C# and I am trying to extract a file with C#, however I keep getting the same errors listed below!

    Error CS0234 The type or namespace name 'FileSystem' does not exist in the namespace 'System.IO.Compression' (are you missing an assembly reference?) LoganUtilitesInstaller C:\Users\logan\source\repos\LoganUtilitesInstaller\LoganUtilitesInstaller\Form1.cs 3 Active

    and

    Error CS0234 The type or namespace name 'FileSystem' does not exist in the namespace 'System.IO.Compression' (are you missing an assembly reference?) LoganUtilitesInstaller C:\Users\logan\source\repos\LoganUtilitesInstaller\LoganUtilitesInstaller\Properties\AssemblyInfo.cs 2 Active

    I have already added a reference to System.IO.Compression and to System.IO.Compression.FileSystem

    Below is my code to the entire program:

    using System;
    using System.IO.Compression;
    using System.IO.Compression.FileSystem;
    using System.IO;
    using System.Net;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    using System.Threading;
    namespace LoganUtilitesInstaller
    {
     public partial class Form1 : Form
     {
      public object ZipFile { get; private set; }
      public Form1()
      {
       InitializeComponent();
      }
      private void Form1_Load(object sender, EventArgs e)
      {
      }
      private void installbutton_Click(object sender, EventArgs e)
      {
       {
        Thread thread = new Thread(() => {
         WebClient client = new WebClient();
         client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged);
         client.DownloadFileCompleted += new AsyncCompletedEventHandler(client_DownloadFileCompleted);
         client.DownloadFileAsync(new Uri("https://github.com/LoganMontgomery/LoganUtilitesInstaller/raw/master/loganutilites.zip"), @"C:\loganutilites.zip");
        });
        thread.Start();
       };

      }
      void client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
      {
       this.BeginInvoke((MethodInvoker)delegate {
        double bytesIn = double.Parse(e.BytesReceived.ToString());
        double totalBytes = double.Parse(e.TotalBytesToReceive.ToString());
        double percentage = bytesIn / totalBytes * 100;
        downloadprogresstext.Text = "Downloaded " + e.BytesReceived + " of " + e.TotalBytesToReceive;
        downloadprogressbar.Value = int.Parse(Math.Truncate(percentage).ToString());
       });
      }
      void client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
      {
       Directory.CreateDirectory(@"C:\LoganUtilites");
                string extractFolder = @"c:\LoganUtilites";
                string zipFile = @"c:\LoganUtilites.zip";
                ZipFile.ExtractToDirectory (zipFile, extractFolder);
                this.BeginInvoke((MethodInvoker)delegate {
        downloadprogresstext.Text = "Completed";
       });
      }
      private void label2_Click(object sender, EventArgs e)
      {
      }
      private void button1_Click(object sender, EventArgs e)
      {

      }
     }
    }

    I hope this enough information, Thanks In Advance!

    Monday, September 24, 2018 9:00 PM

Answers


  • Error CS0234 The type or namespace name 'FileSystem' does not exist in the namespace 'System.IO.Compression' (are you missing an assembly reference?) LoganUtilitesInstaller C:\Users\logan\source\repos\LoganUtilitesInstaller\LoganUtilitesInstaller\Form1.cs 3 Active


    I have already added a reference to System.IO.Compression and to System.IO.Compression.FileSystem

    Below is my code to the entire program:

    using System;
    using System.IO.Compression;
    using System.IO.Compression.FileSystem;

    See this thread:

    https://stackoverflow.com/questions/16860794/system-io-compression-filesystem-dll-in-c-sharp-program

    - Wayne

    Monday, September 24, 2018 10:20 PM

All replies


  • Error CS0234 The type or namespace name 'FileSystem' does not exist in the namespace 'System.IO.Compression' (are you missing an assembly reference?) LoganUtilitesInstaller C:\Users\logan\source\repos\LoganUtilitesInstaller\LoganUtilitesInstaller\Form1.cs 3 Active


    I have already added a reference to System.IO.Compression and to System.IO.Compression.FileSystem

    Below is my code to the entire program:

    using System;
    using System.IO.Compression;
    using System.IO.Compression.FileSystem;

    See this thread:

    https://stackoverflow.com/questions/16860794/system-io-compression-filesystem-dll-in-c-sharp-program

    - Wayne

    Monday, September 24, 2018 10:20 PM

  • Below is my code to the entire program:

    using System;
    using System.IO.Compression;
    using System.IO.Compression.FileSystem; // <<<<< Remove this line.
    using System.IO;
    using System.Net;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    using System.Threading;
    namespace LoganUtilitesInstaller
    {
     public partial class Form1 : Form
     {
      public object ZipFile { get; private set; }// <<<<< Remove this line.

    Remove the two lines indicated above.

    - Wayne

    Monday, September 24, 2018 10:59 PM
  • Hi Logan Montgomery,

    Thank you for posting here.

    You could remove unnecessary usings. I make a gif to show, it could fix the error.

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, September 25, 2018 2:49 AM
    Moderator