Quantcast
Channel: Rebex Q&A Forum - Recent questions and answers
Viewing all articles
Browse latest Browse all 3862

Answered: How to create self extracting zip with rebex.zip?

$
0
0

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

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

STEP 1
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, ".");
    }
}

SETP 2
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.

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

> copy /b self.exe+some.zip self-zip.exe

The some.zip 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.


Viewing all articles
Browse latest Browse all 3862

Trending Articles