Do I need to include Ionic.Zip.dll if I distribute an SFX with custom stub created using DotNetZip lib to my users?

Sep 29, 2011 at 12:10 AM
Edited Sep 29, 2011 at 12:20 AM

As the discussion name stated, I want to distribute SFX with a custom stub to my users. I understand that .Net runtime is required on users's computers since the stub is written in .Net. The question is: do I have to include the Ionic.Zip.dll in the SFX? Since the extraction logic in the stub is using objects derived from the dll, I am guessing the dll has to be in the same folder as the SFX because user computers do not have that dll.

So If the answer is yes, then how should I include the dll in the SFX? Do I have to include it as a zip item and extract it out to the same folder first when the user invokes the SFX, or as a embedded resource that also needs to be extracted first before the stub logic can run? 

I guess even I extract the dll in the first line of the stub logic,  it may still not work becuase Wondows may check the presence of required dll before it actually invoke the SFX, generating a file or assembly not found error in the first place.

Any ideas?

Coordinator
Oct 3, 2011 at 12:20 AM

Yes, you need to include Ionic.Zip.dll into the SFX.  The way to do it is to embed the DLL as a resource in the SFX, and use an assembly resolver at runtime. Like this: http://stackoverflow.com/questions/96732/embedding-one-dll-inside-another-as-an-embedded-resource-and-then-calling-it-from

You should not attempt to put the Ionic.Zip.dll as an item in the ZIP archive. That wouldn't work - you need Ionic.Zip.dll to read the zip, so putting the DLL into the zip won't help you. (You'd have to read the zip to get the library but you need the library to read the zip).