This project is read-only.

Is it possible to create a completely silent SelfExtractor ?

Feb 1, 2010 at 3:41 PM


m using this library to make a selfextracter for my file..but i want in this  that..when i extract (or double click the .exe file) it ll not show any window(console or window).

is it possible??



Feb 2, 2010 at 3:06 AM

If you call SaveSelfExtractor() and specify in the self extractor options, Quiet = True, and Flavor = ConsoleApplication, then, when you double click the resulting EXE, you will get a console window that appears briefly, then disappears. Normally it is visible for less than one second.

There's no way to make a completely invisible Self extracting EXE, using just the library.

If you don't like the options available from the API, You can also write your own self-extractor logic.  See this post for information and hints.

Feb 2, 2010 at 10:34 AM

Thanx Cheeso,

I have tried your suggested solution it worked well,its better for case of consoleApplication flavor but in windowsApplication flavor it shows jus progress bar.

But ISn't it possile that in consoleApplication flavor it would not show any console windows(not just for 1/2 sec).completely silent extraction.??

i have tried events which are provided with ZipFile class. i tried to do something at the time of extraction.



public void MakeExtracter()
                Zip = new ZipFile();
                Selfextract = new SelfExtractorSaveOptions();
                Zip.ExtractProgress += Zip_ExtractProgress;
                _entry=_sourcestr; //_sourcestr is the string variable containg the files;
                Selfextract.Description = "Tru-i Suite";

                Selfextract.Flavor = SelfExtractorFlavor.ConsoleApplication;
                Selfextract.IconFile = _iconstr;
                Selfextract.Quiet = true;
                Selfextract.RemoveUnpackedFilesAfterExecute = true;

                if (_entrystr != null)
                {Selfextract.PostExtractCommandLine = _entrystr;}
                OutputPath = _outputstr;
                Selfextract.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently;
                Zip.SaveSelfExtractor(OutputPath, Selfextract);
            catch (Exception ex)
                Console.WriteLine(ex.ToString() +"\nERROR ::  There is some error while creating extracter of the give source files ");


void Zip_ExtractProgress(object sender, ExtractProgressEventArgs e)
            if (e.EventType == ZipProgressEventType.Extracting_BeforeExtractEntry)
                //Console.WriteLine("Extraction Started..And Test Screen");
                IntPtr hWnd = FindWindow(null, Console.Title);

                if (hWnd != IntPtr.Zero)
                    ShowWindow(hWnd, 0);



Is it right to use this event like is not responding anything..Can you please help me.?

Feb 2, 2010 at 10:21 PM

It is not possble, or I don't know of a way to do it, to provide a console application that does not actually use the console.

It is possible to write a winforms application that does not actually show anything.  But the self-extractor in DotNetZip does not do that; it shows a progress bar. 

In theory, I could add a feature like that.  But today you have to write it yourself.


Regarding your other question about events; the ExtractProgress method is used when you extract.  The ZipFile class calls the Extractprogress event handler, once for each entry as it is being extracted.  But your code does not extract any entries.  Instead you are calling SaveSelfExtractor().   Because you are not doing extract operations, the ExtractProgress never gets called. 

I think you are misunderstanding something.




Feb 2, 2010 at 10:23 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Feb 4, 2010 at 2:30 PM
Edited Feb 4, 2010 at 2:30 PM
Hii, i am trying to customize the SaveSelfExtractor() But i just remove all the lines where it uses ionic.snk file then it showing me error ERROR :: Error reading resource file '..\Zip Partial DLL\Resources\' -- 'The system cannot find the file specified. ' Zip Partial DLL How can i resolve this error??.
Feb 4, 2010 at 11:30 PM
Edited Feb 5, 2010 at 12:34 PM

Ask yourself if you really need to re-build the library.

I referenced a post above that shows you how to create your own self-extractor without re-building the library. It's much simpler than re-building the library.

To directly answer your question - I don't know why your build is not working. If I wanted to diagnose the build error I would look closely through the build log to try to see if there are any indications there of a problem.


Feb 5, 2010 at 7:57 AM

thanx cheeso,

but i just change the CommandLineSelfExtractorStub.cs file and build the library again..But i would not building .If you can suggest me any other solution except rebuilding the library then .

from the referenced post you had provided .i couldn't get how can i use the library any try to customize the code in my way.

I simply want that there should not be any commandprompt open when i try to execute selfextractor file. and for this i am doing this.

please suggest me some solution which you think willl help me.



Feb 5, 2010 at 8:14 AM
Edited Feb 5, 2010 at 9:43 AM
if this could help you to resolve error:: System.ArgumentException: The stream must be non-null Parameter name: zipStream at Ionic.Zip.ZipFile.Read(Stream zipStream, TextWriter statusMessageWriter, Encoding encoding, EventHandler`1 readProgress) in D:\Downloads\DotNetZip-src-v1.9.1.2\DotN etZip\Zip Partial DLL\ZipFile.Read.cs:line 836 at Ionic.Zip.ZipFile._SaveSfxStub(String exeToGenerate, SelfExtractorSaveOptions options) in D:\Downloads\DotNetZip-src-v1.9.1.2\DotNetZip\Zip Partial DLL\ZipFile.Save SelfExtractor.cs:line 734 at Ionic.Zip.ZipFile.SaveSelfExtractor(String exeToGenerate, SelfExtractorSaveOptions options) in D:\Downloads\DotNetZip-src-v1.9.1.2\DotNetZip\Zip Partial DLL\ZipFile .SaveSelfExtractor.cs:line 625
Feb 5, 2010 at 12:38 PM

I don't know what that exception is for.  I understood you were having trouble building the source code.  The exception seems to be a different problem entirely.  Can we focus on one problem at a time, please?

Regarding the suggestion you requested, for building a silent self-extractor.   As I said above, two different times, my suggestion is: please read this post:  and do what it says.

Have you done this?  What results did you get?  I know you want your problem to be solved.  But I am providing answers and you seem to be ignoring them.  Then you ask the question again.  My answer is still the same. 


Feb 5, 2010 at 1:27 PM
thanx cheeso, i have resolved the problem.and successfully build the source code..In the above link you provided,i simply can't get how can you just write your own code for Self-Extractor()..where we are using the library.
Feb 5, 2010 at 1:33 PM

> i simply can't get how can you just write your own code for Self-Extractor()..where we are using the library.

Compile your custom self-extractor logic into an EXE.  During extraction, the EXE should read itself, as a zipfile. 

Then, when saving the zip file, open a stream.  Write the bytes from the exe to the stream.  then save the zipfile to the same stream.  Close the stream.  The resulting file is both an exe and a zipfile. 

Feb 5, 2010 at 2:10 PM
Thanx Cheeso