title: How do I create 7-Zip archives with .NET?
body: <p>How can I create 7-Zip archives from my C# console application? I need to be able to extract the archives using the regular, widely available <a href="http://www.7-zip.org/" rel="noreferrer">7-Zip</a> program.</p>
  
  <hr>
  
  <h2>Here are my results with the examples provided as answers to this question</h2>
  
  <ul>
  <li>"Shelling out" to 7z.exe - this is the simplest and most effective approach, and I can confirm that <strong>it works nicely</strong>. As <a href="https://stackoverflow.com/questions/222030/how-do-i-create-7-zip-archives-with-net#222047">workmad3 mentions</a>, I just need to guarantee that 7z.exe is installed on all target machines, which is something I can guarantee.</li>
  <li><a href="http://www.eggheadcafe.com/tutorials/aspnet/064b41e4-60bc-4d35-9136-368603bcc27a/7zip-lzma-inmemory-com.aspx" rel="noreferrer">7Zip in memory compression</a> - this refers to compressing cookies "in-memory" before sending to the client; this method seems somewhat promising. The wrapper methods (wrapping the <a href="http://www.7-zip.org/sdk.html" rel="noreferrer">LZMA SDK</a>) return type <code>byte[]</code>. When I write the <code>byte[]</code> array to a file, I can't extract it using 7-Zip (<code>File.7z is not supported archive</code>).</li>
  <li><a href="http://www.codeplex.com/7zsharp" rel="noreferrer">7zSharp</a> Wrapper (found on CodePlex) - this wraps the 7z exe/<a href="http://www.7-zip.org/sdk.html" rel="noreferrer">LZMA SDK</a>. I referenced the project from my app, and it successfully created some archive files, but I was unable to extract the files using the regular 7-Zip program (<code>File.7z is not supported archive</code>).</li>
  <li><a href="http://www.7-zip.org/sdk.html" rel="noreferrer">7Zip SDK aka LZMA SDK</a> - I guess I'm not smart enough to figure out how to use this (which is why I posted here)... Any working code examples that demonstrate creating a 7zip archive that is able to be extracted by the regular 7zip program?</li>
  <li><a href="http://www.codeproject.com/KB/DLL/cs_interface_7zip.aspx" rel="noreferrer">CodeProject C# (.NET) Interface for 7-Zip Archive DLLs</a> - only supports extracting from 7zip archives... I need to create them!</li>
  <li><a href="http://sharpdevelop.net/OpenSource/SharpZipLib/Default.aspx" rel="noreferrer">SharpZipLib</a> - According to their <a href="http://wiki.sharpdevelop.net/SharpZipLib_FAQ.ashx" rel="noreferrer">FAQ</a>, SharpZipLib doesn't support 7zip.</li>
  </ul>