【问题标题】:Adding System.IO.Compression assembly to Mono on CentOS 7在 CentOS 7 上将 System.IO.Compression 程序集添加到 Mono
【发布时间】:2018-02-27 05:25:05
【问题描述】:

我正在尝试在我的 C# 程序中使用 System.IO.Compression 程序集。我目前正在运行安装了最新版本的单声道的 CentOS 7。

在尝试使用 System.IO.Compression 中的 ZipFile 类时,我收到以下错误:

Program.cs(48,21):错误 CS0103:名称“ZipFile”在当前上下文中不存在编译失败:1 个错误,0 个警告

这是因为由于某种原因 System.IO.Compression 默认不包括在内,所以您必须添加程序集引用,我可以通过解决方案资源管理器在 Visual Studio 中这样做,但在单声道中我没有办法添加它。 在你说之前,是的,我已经添加了“使用 System.IO.Compression;”这一行。

如果有人对如何将此程序集引用添加到单声道有任何见解,将不胜感激。

【问题讨论】:

    标签: c# .net linux mono centos7


    【解决方案1】:

    我遇到了类似的问题,在问题I didn't find "ZipFile" class in the "System.IO.Compression" namespace中找到了解决方法

    解决方案是引用 System.IO.Compression.FileSystem.dll
    例如。 mcs /reference:System.IO.Compression.FileSystem.dll Main.cs

    【讨论】:

    • 感谢您的回复!在搞砸了很长时间之后,我最终最终使用了您提供的相同解决方案,我只是忘了更新这篇文章!我不知道谁反对这个,因为它是正确的解决方案。
    猜你喜欢
    • 1970-01-01
    • 2014-09-10
    • 2019-06-06
    • 1970-01-01
    • 2017-09-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-03-28
    相关资源
    最近更新 更多