[
  {
    "Id": "591502",
    "ThreadId": "252479",
    "Html": "\r\n<p>I am not sure what is normal for DotNetZip, but I'm a little disappointed in the size discrepancy. &nbsp;We used to use a console version of WinZip that we licensed to created self-extracting zip files. &nbsp;We are extracting a 1kb config file to a specific\r\n location on a PC. &nbsp;In upgrading our toolset, we decided that DotNetZip was worth looking at, and works great except for the self-extracting zip part. &nbsp;Here's what I have:</p>\r\n<p>&nbsp;</p>\r\n<p></p>\r\n<div style=\"color:black; background-color:white\">\r\n<pre><span style=\"color:blue\">string</span> zipFile = Path.Combine(_stagingDir, clientName.ToLower().Replace(<span style=\"color:#a31515\">&quot; &quot;</span>, <span style=\"color:#a31515\">&quot;_&quot;</span>));\r\n<span style=\"color:blue\">using</span> (<span style=\"color:blue\">var</span> zip = <span style=\"color:blue\">new</span> ZipFile(zipFile &#43; <span style=\"color:#a31515\">&quot;.zip&quot;</span>))\r\n{\r\n    zip.CompressionLevel = Ionic.Zlib.CompressionLevel.BestCompression;\r\n    zip.AddFile(theFile, <span style=\"color:#a31515\">&quot;/&quot;</span>);\r\n    zip.Save();\r\n}\r\n\r\nCreateSfx(<span style=\"color:blue\">new</span> ZipFile(zipFile &#43; <span style=\"color:#a31515\">&quot;.zip&quot;</span>), zipFile &#43; <span style=\"color:#a31515\">&quot;.exe&quot;</span>);\r\n</pre>\r\n</div>\r\n<p></p>\r\n<p>This part works great - it generates at 1kb zip file, as expected. &nbsp;Love it. &nbsp;Then I want to create the exe ... (I took this out of the using loop so I could keep the zip file behind as well - which is something else I need to look at, it bombed\r\n if zip.Save() was called):</p>\r\n<p></p>\r\n<div style=\"color:black; background-color:white\">\r\n<pre><span style=\"color:blue\">public</span> <span style=\"color:blue\">static</span> <span style=\"color:blue\">void</span> CreateSfx(ZipFile zip, <span style=\"color:blue\">string</span> zipFile)\r\n{\r\n    <span style=\"color:green\">// set the options</span>\r\n    <span style=\"color:blue\">var</span> sfxOptions = <span style=\"color:blue\">new</span> SelfExtractorSaveOptions();\r\n    sfxOptions.Flavor = SelfExtractorFlavor.ConsoleApplication;\r\n    sfxOptions.Quiet = <span style=\"color:blue\">true</span>;\r\n    sfxOptions.DefaultExtractDirectory = <span style=\"color:#a31515\">&quot;C:\\\\ConfigFileLocation&quot;</span>;\r\n    sfxOptions.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently;\r\n\r\n    <span style=\"color:green\">// create file</span>\r\n    zip.SaveSelfExtractor(zipFile, sfxOptions);\r\n}\r\n</pre>\r\n</div>\r\n<p></p>\r\n<p>This part isn't so great. &nbsp;The resulting file - from the 1kb zip file - is a 506kb exe. &nbsp;If I take the zip file created by DotNetZip and run it through the WinZip &quot;Create Self-Extracting Zip&quot; tool, it creates a 20kb exe, which is what I'm looking\r\n for.</p>\r\n<p>Am I missing something? &nbsp;Is this normal?</p>\r\n",
    "PostedDate": "2011-04-04T11:50:22.85-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "591581",
    "ThreadId": "252479",
    "Html": "<p>yes, that sounds about right. DotNetZip is 400k (ish) and when you create an SFX, it embeds the DotNetZip library into the exe.&nbsp; I realized this was overkill, when I did it - of course you don't need a full zip library to do extraction, you only need the extraction capability.&nbsp; I created a workitem to track the feature request, but I've never implemented it.</p>\r\n<p>If I optimized the embedded logic for SFX, I think the resulting SFX would be much much smaller but I'd estimate that it would still be much larger than 20k.</p>",
    "PostedDate": "2011-04-04T13:26:04.443-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "591590",
    "ThreadId": "252479",
    "Html": "<p>Cheeso - I didn't realize it was embedding the whole library in there - that would definitely explain it. &nbsp;I'd love to see a smaller sfx-only library get embedded. &nbsp;This project being open-source and all, maybe I'll have a look and see if I can come up with something. &nbsp;I'll let you know if I come up with a solution that minimizes the space used.</p>",
    "PostedDate": "2011-04-04T13:35:53.547-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "592832",
    "ThreadId": "252479",
    "Html": "<p>Yup - the whole library.&nbsp; I thought about fixing it.&nbsp; It isn't necessary to include the parts that do encoding.&nbsp; But even so, it's hard to leave things out.&nbsp; If the zip is not WinZip AES encrypted, then you wouldn't need that entire subset, but... currently that logic is just bindled into the single assembly.&nbsp; You would never need Zlib or GZipStream, since zip files use only DeflateStream.&nbsp;</p>\r\n<p>It would require some creative restructuring of the packaging of the library.</p>\r\n<p>The most technically attractive idea is to produce a C/C++ version of the unzip logic, and embed <em>that</em>; that would allow the size of an SFX to be reduced pretty nicely and would also eliminate the dependency on .NET. &nbsp; But that increases the scope of development and testing pretty dramatically.&nbsp;&nbsp;It would be a completely new implementation of unzip.&nbsp;</p>\r\n<p>In the end I didn't feel satisfied with any of these approaches, so I did nothing.</p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2011-04-06T08:04:45.7-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]