Installed .Net 4.5 but can't use ZipFile class in Visual C#

See ZipFile Class on MSDN. It shows the required framework version is 4.5. Once the framework version is fixed check you have added a reference to the System.IO.Compression.FileSystem.dll assembly and added a using System.IO.Compression directive to your class.


You also need to reference the System.IO.Compression.FileSystem.dll assembly.


Just to further clarify the previous answers, here's how to add the references manually to a Web.config:

<configuration>
  <system.web>
    <compilation targetFramework="4.5">
      <assemblies>
        <add assembly="System.IO.Compression, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
        <add assembly="System.IO.Compression.FileSystem, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
      </assemblies>
    </compilation>
  </system.web>
</configuration>

Or to a *.csproj:

<Project ...>
  <ItemGroup>
    <Reference Include="System.IO.Compression, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089, processorArchitecture=MSIL" />
    <Reference Include="System.IO.Compression.FileSystem, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089, processorArchitecture=MSIL" />
  </ItemGroup>
</Project>

The files can be found in C:\Windows\Microsoft.NET\assembly\GAC_MSIL\ and the subfolders contain the necessary info on version, culture and PublicKeyToken as well.