Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/307.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在没有其他Nuget软件包的情况下打开zip文件?_C#_Zip - Fatal编程技术网

C# 如何在没有其他Nuget软件包的情况下打开zip文件?

C# 如何在没有其他Nuget软件包的情况下打开zip文件?,c#,zip,C#,Zip,我有以下代码: public static class PracticeFunction { [FunctionName("LearningAboutFunctions")] public static void Run([TimerTrigger("0 */5 * * * *")]TimerInfo myTimer, ILogger log) { log.LogInformation($"C# Timer

我有以下代码:

    public static class PracticeFunction 
    {
        [FunctionName("LearningAboutFunctions")]
        public static void Run([TimerTrigger("0 */5 * * * *")]TimerInfo myTimer, ILogger log)
        {
            log.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}");

            using (var client = new WebClient())
            {
                client.DownloadFile("https://examplesite.co.uk/file.zip", "myfile.zip");
            }
        }
    }
}


有没有一种方法可以打开Zip文件并提取内容,而无需安装任何额外的nuget软件包

试试这样的东西

using System.IO.Compression;

string startPath = @"C:\Users\host\Desktop\Folder";
            string zipPath = startPath + @"\Zipfile.zip";
            string extractPath = @"C:\Users\host\Desktop\Final Folder\";
            ZipFile.ExtractToDirectory(zipPath, extractPath);

您可以使用ZipFile:您不必下载任何nuget软件包,但必须在您喜爱的引擎中添加程序集引用搜索C解压文件-内置ZipFile类的文档应位于或接近顶部。请尝试powershellcommand@PaulSütterlin和D Stanley,您假设用户的目标是>=4.5框架。。。否则,该功能将不适用。请更新您的帖子,以包含您的目标版本。@Jordan1993在提供的示例中,没有尝试解压缩文件。目前,这个问题正在寻求意见和/或建议,不幸的是,这些意见和/或建议在这里是离题的。如果您能提供导致问题的实际代码,我们可能会对您有所帮助,否则,您在这里寻求的结果是什么?一个小建议:看看如何结合startPath和zipPath。