How to create self extracting zip with

0 votes
asked Dec 30, 2021 by William (120 points)

I am doing a 30 day trial of for use in our software. I cannot seem to find a way to get to generate a self extracting zip. Does it have this feature?

Applies to: Rebex ZIP

1 Answer

0 votes
answered Dec 30, 2021 by Lukas Matyska (61,230 points)
edited Dec 30, 2021 by Lukas Matyska

Unfortunately, self extracting feature is not supported by Rebex ZIP.

However, you can create self extracting zip for platforms with .NET support like this:

Write your own unpacker application. For example like this:

class Program
    static void Main(string[] args)
        var codeBase = new UriBuilder(typeof(Program).Assembly.CodeBase);
        string path = Uri.UnescapeDataString(codeBase.Path);

        ZipArchive.ExtractAll(path, ".");

Merge your unpacker with dependencies into single .exe using ILMerge:

> ilmerge /out:self.exe unpacker.exe Rebex.Common.dll Rebex.Zip.dll

The unpacker.exe is your unpacker application from STEP 1.

Append your regular .zip file to the end of the produced self.exe file. For example:

> copy /b self-zip.exe

The is a regular .zip file you want to turn into self extracting zip file.

The self-zip.exe is final self extracting zip file, which you can distribute. It can be extracted on systems with appropriate .NET support. For example, if your unpacker.exe is build for .NET 4.0, the self-zip.exe can be extracted on systems with support for .NET 4.0.