[
  {
    "Id": "600481",
    "ThreadId": "254680",
    "Html": "\r\n<p>I have a desktop application that requires .NET4.0 to operate. &nbsp;As one of it's operations, it's creates some self-extracting zips. &nbsp;These still target .NET4.0, but I need them to target .NET2.0. &nbsp;Is that possible, or will the Sfx's always\r\n inherit the framework of the parent application? &nbsp;The PC's they are running on are guaranteed to have .NET2.0 but not guaranteed to have .NET4.0, so that's why I'd like for them to target that older framework.</p>\r\n",
    "PostedDate": "2011-04-20T09:02:44.65-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "600544",
    "ThreadId": "254680",
    "Html": "<p>Good question.</p>\r\n<p>It was my intention that the machine that runs a DotNetZip-generated SFX would required .NET 2.0, only.&nbsp;&nbsp;But, I don't have a .NET 4.0 machine, and I have not tested the case you described. I would guess it would \"just work\" but I'm not sure.</p>\r\n<p>I&nbsp;cannot remember now, what I specified for the compiler switches that DotNetZip uses when generating the SFX.&nbsp;&nbsp;</p>\r\n<p>The way it works is that, within ZipFile.SaveSelfExtractor(), &nbsp;DotNetZip calls into the CSharpCompiler classes, which actually causes csc.exe to be invoked. And there is an option to csc.exe that allows you to specify the target framework.&nbsp; I'm pretty sure (not looking at the code right now) that I used that switch to insure the .NET 2.0 dependency.&nbsp;&nbsp;I would expect that this compiler switch also exists on the .NET Framework 4.0 version of the compiler.</p>\r\n<p>I'll have to look at the code.&nbsp; In the meantime, I&nbsp;don't have a .NET 4.0 machine; would it be possible for you to generate an SFX on your .NET 4.0 machine and then try running it on a machine with only .NET 2.0?</p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2011-04-20T10:56:08.02-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "600610",
    "ThreadId": "254680",
    "Html": "<p>Cheeso - that is what I have done, and I get an error that the workstation needs to have .NET Framework version 4.0.xxxxx installed for it to extract. &nbsp;Tonight I am going to try to recompile my app as .NET 2.0 and see if that makes any difference. &nbsp;The other option is csc.exe is different on my machine because I'm running Win7.</p>\r\n<p>I'm looking ZipFile.SaveSelfExtractor.cs and I don't see any switch to csc.exe that would specify the framework. &nbsp;I'm not sure what that switch is. &nbsp;I don't have time to research right now but I'll take a look today/tomorrow and see.</p>\r\n<p>I'm still looking at ways to minimize the Sfx file size too ... not found a good solution yet ...</p>",
    "PostedDate": "2011-04-20T12:32:31.553-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "600639",
    "ThreadId": "254680",
    "Html": "<p>Well, my app won't recompile as .NET 2.0 due to an SSH plugin I'm using that requires 4.0 (SSH.NET). &nbsp;Still looking into other parts ...</p>",
    "PostedDate": "2011-04-20T13:16:08.717-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "603178",
    "ThreadId": "254680",
    "Html": "<p>ok let me look into this further.&nbsp;</p>",
    "PostedDate": "2011-04-26T13:35:05.517-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "603777",
    "ThreadId": "254680",
    "Html": "<p>Cheeso - I can confirm that, with my app that targets 4.0, the Sfx's require 4.0 - on a workstation with only 2.0 installed, it failed stating that 4.0 was needed.</p>\n<p>I thought I had found the option needed, and I tested it a few moments ago but it still compiled the Sfx as 4.0. &nbsp;I'm looking into it still myself. &nbsp;What I did was replace your call to the CSharpCodeProvider in ZipFile.SaveSelfExtractor.cs on line  704 with:</p>\n<p>&nbsp;</p>\n<div style=\"color: black; background-color: white;\">\n<pre>                <span style=\"color: green;\">// target the 2.0 framework</span>\n                <span style=\"color: blue;\">var</span> compilerOptions = <span style=\"color: blue;\">new</span> Dictionary&lt;<span style=\"color: blue;\">string</span>, <span style=\"color: blue;\">string</span>&gt;\n                { \n                    { <span style=\"color: #a31515;\">\"CompilerVersion\"</span>, <span style=\"color: #a31515;\">\"v2.0\"</span> }\n                };\n\n                Microsoft.CSharp.CSharpCodeProvider csharp = <span style=\"color: blue;\">new</span> Microsoft.CSharp.CSharpCodeProvider(compilerOptions);\n</pre>\n</div>\n<p>&nbsp;</p>\n<p>According to these two articles, that should have worked, but didn't:</p>\n<p><a href=\"http://stackoverflow.com/questions/1200639/csharpcodeprovider-seems-to-be-stuck-at-net-2-0-how-do-i-get-new-features\">http://stackoverflow.com/questions/1200639/csharpcodeprovider-seems-to-be-stuck-at-net-2-0-how-do-i-get-new-features</a></p>\n<p>http://msdn.microsoft.com/en-us/library/bb537926.aspx#Y700</p>\n<p>I'm not sure if I missed something else in the code that is overriding that setting (such as a config file) but I didn't think so. &nbsp;A little stumped as to why that didn't work!</p>",
    "PostedDate": "2011-04-27T12:59:02.027-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "607923",
    "ThreadId": "254680",
    "Html": "<p>Cheeso - well, I have no idea what I did wrong the first time, but my code snippet above works. &nbsp;By adding just that line, it compiles targeting the 2.0 framework. &nbsp;I think I may also add a new option to the SfxOptions to select a version. &nbsp;I don't have access to commit any code, though - could I email you the finished file or could I be made a contributor?</p>\r\n<p>... Feel a little dumb I failed to properly test the file that I generated the first time! &nbsp;I must have copied the wrong executable over to my 2.0-only workstation to test. &nbsp;Argh, it's always the little things.</p>",
    "PostedDate": "2011-05-05T09:53:28.07-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "608943",
    "ThreadId": "254680",
    "Html": "<p>Thanks - that would be very useful.</p>\r\n<p>To submit an update, you can <a href=\"http://dotnetzip.codeplex.com/SourceControl/list/patches/upload\">upload a patch</a>.&nbsp; Just include the files you've modified, I'll be able to see the diff.</p>\r\n<p>Thanks very much for the effort.</p>",
    "PostedDate": "2011-05-07T06:30:25.453-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]