This project is read-only.


Self Extracting Archive and file removal


This is from a discussion thread:
I have been running into a strange issue with a self extracting archive and RemoveUnpackedFilesAfterExecute = true. When I execute the created self extracting archive, it extracts and executes the file I have directed it to. When that executable finishes, only one file is deleted that was extracted (there were 8 files in the archive). I am not sure if this is a bug or I am doing something incorrectly. My code to create the package is below:
     private void btnPackage_Click(object sender, EventArgs e) {
        string outputFileName;
        using (Ionic.Zip.ZipFile zip = new Ionic.Zip.ZipFile()) {
            // Add manifest file
            zip.AddFile(txtManifestFilePath.Text, ".");
            // Add wizard file
            zip.AddFile(txtWizardFilePath.Text, ".");
            // Add resource files
            zip.AddFiles(resourceFilePaths, ".");
            zip.Encryption = Ionic.Zip.EncryptionAlgorithm.WinZipAes256;
            Ionic.Zip.SelfExtractorSaveOptions options = new Ionic.Zip.SelfExtractorSaveOptions();
            options.DefaultExtractDirectory = "%TEMP%";
            options.ExtractExistingFile = Ionic.Zip.ExtractExistingFileAction.OverwriteSilently;
            options.Flavor = Ionic.Zip.SelfExtractorFlavor.ConsoleApplication;
            options.IconFile = System.IO.Path.Combine(Application.StartupPath, "box_software.ico");
            options.PostExtractCommandLine = System.IO.Path.GetFileName(txtWizardFilePath.Text);
            options.Quiet = true;
            options.RemoveUnpackedFilesAfterExecute = true;
            outputFileName = txtOutputFilename.Text;
            if (!outputFileName.EndsWith(".exe")) {
                outputFileName = string.Concat(outputFileName, ".exe");
            zip.SaveSelfExtractor(outputFileName, options);
Closed Jun 19, 2011 at 2:18 AM by Cheeso
fixed in workitem 79406. First binary with this change will be v1.9.1.6