Thank you for providing the DotNetZip library. It's been wonderful so far.
I'm having some trouble with replacing the SFX stub though. I'd like to provide the same "use" as the current SFX, just with a couple more options in the UI (I do some preprocessing on the files before they are extracted).
I read the thread at: http://dotnetzip.codeplex.com/Thread/View.aspx?ThreadId=70602
Specifically the post from
Oct 15 2009 at 12:32 AM
I implemented your logic, and can create the exe fine:
string outputFile = "sfx.exe";
string sfxStub = "Stub.exe";
byte buffer = new byte;
using (System.IO.FileStream output = new FileStream(outputFile, FileMode.Create))
using (ZipFile zip = new ZipFile())
using (System.IO.FileStream input = new FileStream(sfxStub, FileMode.Open))
int n = 1;
while ((n = input.Read(buffer, 0, buffer.Length)) > 0)
output.Write(buffer, 0, n);
But when I attempt to read it back in, inside the stub, I get a System.IO.FileNotFound exception on the using line:
Assembly assembly = Assembly.GetExecutingAssembly();
using (Ionic.Zip.ZipFile file = ZipFile.Read(assembly.Location))
The other thing I realized, if I use this method, dependencies won't be included in the EXE will it? Should I run ILMerge after builds to merge the required assemblies into the stub exe, so that it's self contained?
Thanks for any help.