[
  {
    "Id": "727494",
    "ThreadId": "286653",
    "Html": "\r\n<p>Hi</p>\r\n<p>I developed a utility using DotNetZip library. It create a self extractor successfully but it&nbsp;throws&nbsp;error &quot;Cannot Create a file when that file already exists.&quot;&nbsp;when it runs to extract files from self&nbsp;extractor&nbsp;file.</p>\r\n<p>Here is the code:</p>\r\n<p>&nbsp;</p>\r\n<div style=\"color:black; background-color:white\">\r\n<pre>ZipFile zipFile = <span style=\"color:blue\">new</span> ZipFile();\r\n                <span style=\"color:blue\">foreach</span> (<span style=\"color:blue\">string</span> file <span style=\"color:blue\">in</span> files)\r\n                {\r\n                    <span style=\"color:blue\">if</span> (File.Exists(file))\r\n                    {\r\n                        zipFile.AddEntry(file, (OpenDelegate)(name =&gt; File.Open(file, FileMode.Open, FileAccess.Read)), (CloseDelegate)((name, stream) =&gt; stream.Close()));\r\n                    }\r\n                }\r\n                SelfExtractorSaveOptions options = <span style=\"color:blue\">new</span> SelfExtractorSaveOptions {\r\n                    DefaultExtractDirectory = <span style=\"color:blue\">this</span>.txtInstalledPath.Text,\r\n                    Flavor = SelfExtractorFlavor.WinFormsApplication,\r\n                    SfxExeWindowTitle = <span style=\"color:blue\">string</span>.Format(<span style=\"color:#a31515\">&quot;Test Patch&quot;</span>),\r\n                    ProductName = <span style=\"color:#a31515\">&quot;Test&quot;</span>,\r\n                    ProductVersion = <span style=\"color:#a31515\">&quot;1.0.0.0&quot;</span>,\r\n                    ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently,\r\n                    RemoveUnpackedFilesAfterExecute = <span style=\"color:blue\">true</span>                    \r\n                };\r\n                <span style=\"color:blue\">string</span> exeToGenerate = <span style=\"color:blue\">string</span>.Format(<span style=\"color:#a31515\">@&quot;patch.exe&quot;</span>);\r\n                zipFile.SaveSelfExtractor(exeToGenerate, options);\r\n</pre>\r\n</div>\r\n<p>&nbsp;</p>\r\n<p>&nbsp;</p>\r\n",
    "PostedDate": "2012-01-19T03:18:38.52-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]