[
  {
    "Id": "523088",
    "ThreadId": "234987",
    "Html": "\r\n<p>facing an issue with the self extracting file,</p>\r\n<p>on my own pc it works fine, o other &nbsp;pc's when trying to open this file i get this error message box:</p>\r\n<p><strong>&quot;.NET Framework Initialization Error</strong></p>\r\n<p><strong>to run this application you first must install one of the following versions of the .NET Framework v4.0...&quot;</strong></p>\r\n<p>my application is targeting the&nbsp;<strong>.NET 4.0 framework</strong>.</p>\r\n<p>is there some workaround or a way to bundle the&nbsp;.Net framework with the installed if its not installed on the computer ?</p>\r\n<p>&nbsp;</p>\r\n<p>&nbsp;</p>\r\n<p>here is my code</p>\r\n<p></p>\r\n<div style=\"color:black; background-color:white\">\r\n<pre><span style=\"color:blue\">Protected</span> <span style=\"color:blue\">Sub</span> Download1_Click(<span style=\"color:blue\">ByVal</span> sender <span style=\"color:blue\">As</span> <span style=\"color:blue\">Object</span>, <span style=\"color:blue\">ByVal</span> e <span style=\"color:blue\">As</span> EventArgs) <span style=\"color:blue\">Handles</span> Download1.Click\r\n        <span style=\"color:blue\">Try</span>\r\n\r\n            <span style=\"color:blue\">Dim</span> emptyCheckboxList <span style=\"color:blue\">As</span> <span style=\"color:blue\">Boolean</span> = <span style=\"color:blue\">False</span>\r\n            <span style=\"color:blue\">Dim</span> ItemsNum <span style=\"color:blue\">As</span> Int32 = chklst.Items.<span style=\"color:blue\">Count</span>()\r\n            <span style=\"color:blue\">Dim</span> MyFileStream <span style=\"color:blue\">As</span> FileStream\r\n            <span style=\"color:blue\">Dim</span> FileSize <span style=\"color:blue\">As</span> <span style=\"color:blue\">Long</span>\r\n            <span style=\"color:blue\">Dim</span> fp <span style=\"color:blue\">As</span> StreamWriter\r\n\r\n            Response.Clear()\r\n\r\n            <span style=\"color:blue\">Using</span> zip <span style=\"color:blue\">As</span> <span style=\"color:blue\">New</span> ZipFile()\r\n\r\n                <span style=\"color:blue\">For</span> <span style=\"color:blue\">Each</span> lstItem <span style=\"color:blue\">In</span> chklst.Items\r\n\r\n                    <span style=\"color:blue\">If</span> lstItem.Selected = <span style=\"color:blue\">True</span> <span style=\"color:blue\">Then</span>\r\n                        emptyCheckboxList = <span style=\"color:blue\">True</span>\r\n                        zip.AddFile(Server.MapPath(<span style=\"color:#a31515\">&quot;.\\files\\&quot;</span>) &amp; lstItem.ToString, <span style=\"color:#a31515\">&quot;&quot;</span>)\r\n                    <span style=\"color:blue\">End</span> <span style=\"color:blue\">If</span>\r\n                <span style=\"color:blue\">Next</span>\r\n \t\t<span style=\"color:green\">' save self extracting file to server</span>\r\n                zip.SaveSelfExtractor(Server.MapPath(<span style=\"color:#a31515\">&quot;.\\files\\temp\\&quot;</span>) &amp; exeFileName, SelfExtractorFlavor.ConsoleApplication)\r\n            <span style=\"color:blue\">End</span> <span style=\"color:blue\">Using</span>\r\n\r\n          \r\n            MyFileStream = <span style=\"color:blue\">New</span> FileStream(Server.MapPath(<span style=\"color:#a31515\">&quot;.\\files\\temp\\&quot;</span>) &amp; exeFileName, FileMode.Open)\r\n            FileSize = MyFileStream.Length\r\n\r\n            <span style=\"color:blue\">Dim</span> Buffer(<span style=\"color:blue\">CInt</span>(FileSize)) <span style=\"color:blue\">As</span> <span style=\"color:blue\">Byte</span>\r\n            MyFileStream.Read(Buffer, 0, <span style=\"color:blue\">CInt</span>(FileSize))\r\n            MyFileStream.Close()\r\n\r\n            Response.ContentType = <span style=\"color:#a31515\">&quot;application/exe&quot;</span>\r\n             Response.AddHeader(<span style=\"color:#a31515\">&quot;Content-Disposition&quot;</span>, <span style=\"color:#a31515\">&quot;attachment; filename=&quot;</span> &amp; exeFileName)\r\n          <span style=\"color:blue\">Using</span> fs <span style=\"color:blue\">as</span> <span style=\"color:blue\">New</span> Filestream(Server.MapPath(<span style=\"color:#a31515\">&quot;.\\files\\temp\\&quot;</span>) &amp; exeFileName, FileMode.OpenOrCreate, FileAccess.Read)\r\n           <span style=\"color:blue\">Dim</span> Buffer2(2048) <span style=\"color:blue\">as</span> <span style=\"color:blue\">Byte</span> <span style=\"color:blue\">Dim</span> n <span style=\"color:blue\">as</span> Int32 \r\n              <span style=\"color:blue\">Do</span> n = fs.Read(Buffer2, 0, 2048)   \r\n              Response.OutputStream.Write(Buffer2, 0, n)     \r\n           <span style=\"color:blue\">Loop</span> <span style=\"color:blue\">While</span> n &gt; 0 \r\n         <span style=\"color:blue\">End</span> <span style=\"color:blue\">Using</span> \r\n       Response.Flush()      \r\n       Response.Close()\r\n\r\n\r\n<span style=\"color:blue\">If</span> emptyCheckboxList = <span style=\"color:blue\">False</span> <span style=\"color:blue\">Then</span>\r\n ErrorLbl.Text = <span style=\"color:#a31515\">&quot;No File was chosen for download, please select files &quot;</span>\r\n <span style=\"color:blue\">Else</span> \r\nErrorLbl.Text = <span style=\"color:#a31515\">&quot;&quot;</span> <span style=\"color:blue\">End</span> <span style=\"color:blue\">If</span>\r\n <span style=\"color:blue\">Catch</span> ex <span style=\"color:blue\">As</span> Exception     \r\n        ErrorLbl.Text = <span style=\"color:#a31515\">&quot;Download_Click: &quot;</span> &amp; ex.Message                \r\n         <span style=\"color:blue\">Return</span>\r\n <span style=\"color:blue\">End</span> <span style=\"color:blue\">Try</span>\r\n <span style=\"color:blue\">End</span> <span style=\"color:blue\">Sub</span>\r\n</pre>\r\n</div>\r\n<p></p>\r\n<p>&nbsp;</p>\r\n<p>&nbsp;</p>\r\n<p>Thanks</p>\r\n<p>Buzi</p>\r\n",
    "PostedDate": "2010-11-17T00:49:27.753-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "523150",
    "ThreadId": "234987",
    "Html": "\r\n<p>I had typed in a long detailed answer for your question, but my internet connection went down, and I lost it.</p>\r\n<p>An SFX is a .NET application. As such it requires that the .NET Framework be present on the computer that runs the SFX.&nbsp; There is no way for a .NET application itself to guarantee that the requisite .NET Framework is available before running.</p>\r\n<p>One approach to insuring that pre-requisites in general are available on a computer is to package the application into an MSI (Microsoft Installer).&nbsp; You can build one of these using a Setup and Deployment project in Visual Studio.&nbsp; In the project\r\n you can stipulate the pre-requisites, including the .NET Framework runtime. An MSI offers other features as well:&nbsp; the user can choose an installation directory, can review and select optional features for the application, and can uninstall the application\r\n later using MSI.&nbsp; This is probably the best way to distribute a custom .NET application that is beyond simplistic.</p>\r\n<p>The MSI is not a good approach to distribute an SFX application.&nbsp; I said earlier that an SFX is just a .NET application.&nbsp; So why should the SFX be treated differently than&nbsp;other .NET Applications? It's this: the SFX is not intended to be run\r\n repeatedly, and used over the long term. It's typically something you run once.&nbsp; As such, a better way to insure pre-requisites in this case is to tell the user to install the .NET Framework, perhaps by referring the user to a URL where the .NET Framework\r\n can be downloaded, like <a href=\"http://www.microsoft.com/net/download.aspx\">http://www.microsoft.com/net/download.aspx</a>&nbsp;.</p>\r\n<p>A similar approach may be appropriate for deploying your application. If it's a fairly simple app, then just asking people to install .NET 4 with a URL click, might be the right approach.</p>\r\n",
    "PostedDate": "2010-11-17T03:18:01.003-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "523155",
    "ThreadId": "234987",
    "Html": "\r\n<p>Hi Cheeso, i guess this is the right approach.</p>\r\n<p>thank you again for your quick responses.</p>\r\n<p>buzi</p>\r\n",
    "PostedDate": "2010-11-17T03:24:23.667-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "676668",
    "ThreadId": "234987",
    "Html": "<p>Hi Cheeso,</p>\r\n<p>Using Ionic.Zip v1.9.1.8 to create a self extracting zip.<br />The FAQ says \"The self-extractors require .NET 2.0 on the computer doing the extraction\".<br />When I try to run the self extrator on a machine that only has .Net 2.0 Service Pack 2, <br />I get a .Net Framework Initialization Error:<br />\"To run this application, you first must install one of the following versions of the .Net Framework: v4.0.30319\"</p>\r\n<p>I understand the above answer to buzibuzi. so, I'm not ask HOW do I get 4.0 on a pc.</p>\r\n<p>My question is; Am I missing something, or has the .Net Framework&nbsp;requirement changed?</p>",
    "PostedDate": "2011-09-26T05:47:35.38-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "677515",
    "ThreadId": "234987",
    "Html": "<p>This is a bug in DotNetZip.&nbsp; I've already filed a workitem; need to implement the change and fix it.</p>",
    "PostedDate": "2011-09-27T21:24:32.24-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "810662",
    "ThreadId": "234987",
    "Html": "<p>Has this bug been fixed.</p>",
    "PostedDate": "2012-03-14T23:25:36.53-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]