Search Unity

error CS1069: The type name 'ZipArchive' could not be found in the namespace 'System.IO.Compression'

Discussion in 'Scripting' started by MiaoBolverk, Jul 17, 2019.

  1. MiaoBolverk

    MiaoBolverk

    Joined:
    Feb 6, 2018
    Posts:
    26
    When I build my project, which references the System.IO.Compression namespace, the build succeeds without issue inside Visual Studio.

    However, inside the Unity editor, I see the following error:

    error CS1069: The type name 'ZipArchive' could not be found in the namespace 'System.IO.Compression'. This type has been forwarded to assembly 'System.IO.Compression, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' Consider adding a reference to that assembly.​

    I added a csc.rsp file inside my Assets folder, with the following line:

    -r:System.IO.Compression.FileSystem.dll​

    Unfortunately, that did not resolve the issue.

    For reference, here are the properties of the System.IO.Compression DLL that I reference inside Visual Studio:

    upload_2019-7-17_12-57-36.png

    How can I fix this error?
     
  2. Peter77

    Peter77

    Joined:
    Jun 12, 2013
    Posts:
    4,135
    Can you check if "Scripting Runtime" in player settings is set to ".net4.x".
     
  3. shertig

    shertig

    Joined:
    Sep 20, 2018
    Posts:
    1
    I have a similar issue with that DLL. I use the same cscs.rsp file as described above.

    Strangely enough, Unity is able to build successfully, but while building in Unity I get 24 occurrences of the error "C:/Path/To/Project/Assets/csc.rsp Parse Error : csc: not parsed correctly: System.IO.Compression.FileSystem.dll could not be found as a system library.
    If this was meant as a user reference please provide the relative path from project root (parent of the Assets folder) in the response file.
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)".

    "Scripting Runtime" in player settings is set to ".NET4.x", "Scripting Backend" to ".NET", and "Api Comp. Level" to ".NET 4.x."