前记录:首先本人项目设计需要将文件进行压缩和解压的操作,语言为c#,从网上找的很多都是半成品,不足而论,并且坑多。一度以为是我的电脑出现了问题,差点把自己的电脑给用win10 重装系统。后来想了一下,用别的方法实验一下,发现并不是自己电脑的问题,于是就查看和采用别的方式而不采用引用dll文件的形式。解决了基本的核心问题。现在再次记录,以防后效。
首先我用的是winform 程序进行编写测试,版本必须为 .net 4.5 原因为4.5以后才支持压缩文件的操作。
需要引入的命名空间为
using System.IO;
using System.IO.Compression;
然后引入程序文件,需要2个同时候引入如图:
程序运行图如下:
相关的代码如下:
using System;
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.IO;
using System.IO.Compression;
<