How to extract zip file contents into a folder in .NET 4.5
<p>The following question's answer seems to outline how to extract files using the System.IO.Commpression.ZipFile.ExtractToDirectory method invocation.  "ZipFile" doesn't seem to exist in .NET 4.5, when adding a reference to System.IO.Compression.  How can I extract files from a *.zip file in .NET 4.5?</p>

<p><a href="https://stackoverflow.com/questions/16052877/how-to-unzip-all-zip-file-from-folder-using-c-sharp-4-0-and-without-using-any-o">How to Unzip all .Zip file from Folder using C# 4.0 and without using any OpenSource Dll?</a></p>

<p>This seems to show how to compress files.  But I'm looking for the reverse.</p>

<p><a href="https://stackoverflow.com/questions/33075770/zipping-files-in-net-4-5">Zipping files in .NET 4.5</a></p>

<p>Even this question references "ZipFile" in the source code.  But I can't seem to find this class.</p>

<p><a href="https://stackoverflow.com/questions/22133053/how-to-extract-just-the-specific-directory-from-a-zip-archive-in-c-sharp-net-4">How to extract just the specific directory from a zip archive in C# .NET 4.5?</a></p>

<p><a href="https://i.stack.imgur.com/RgTOA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RgTOA.png" alt="enter image description here"></a></p>

<h1>EDIT:</h1>

<p>Notice how 7z.exe (from 7zip package) didn't work.  There must be a conflict with .NET and 7zip.  ZipFile now seems to work fine.</p>

<pre><code>private void extract_Click(object sender, EventArgs e)
{
    string exePath = System.Reflection.Assembly.GetExecutingAssembly().Location;
    exePath = @"C:\test";  // path during troubleshooting

    ////var cmd1 = "cd \"" + exePath + "\"";
    ////ExecuteCommand(cmd1, 100, exePath);

    //var cmd2 = "\"" + exePath + "\\7z.exe\" x \"" + exePath + "\\source.zip\"";
    //ExecuteCommand(cmd2, 100, exePath);

    string zipPath = exePath + "\\source.zip";
    string extractPath = exePath;

    // needed explicit reference to System.IO.Compression.FileSystem
    ZipFile.ExtractToDirectory(zipPath, extractPath);


}

private static int ExecuteCommand(string command, int timeout, string dir)
{
    var processInfo = new ProcessStartInfo("cmd.exe", " /C " + command)
    {
        CreateNoWindow = true,
        UseShellExecute = false,
        WorkingDirectory = dir,
    };

    var process = Process.Start(processInfo);
    process.WaitForExit(timeout);
    var exitCode = process.ExitCode;
    process.Close();
    return exitCode;
}
</code></pre>