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

wuxilixi picture wuxilixi · Jan 8, 2013 · Viewed 51.1k times · Source

I'm kind of a newbie to Visual Studio programming.

I recently upgraded .Net 4.0 to 4.5 in order to use the ZipFile class under System.IO.Compression, but after the installation completed, Visual Studio (I'm using 2012) still cannot recognize ZipFile as a class name.

I've made sure that .Net 4.5 appears in Control Panel programs list and my C# solution sets .Net Framework 4 as the target framework.

Could someone help me figure this out?

Answer

Daniel Kelley picture Daniel Kelley · Jan 8, 2013

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.