How to create a SFX ZIP with SevenZipSharp?

2.6k views Asked by At

I have been looking at SevenZipSharp to create a self extracting zip file. The project page says that they have a special class SevenZipSfx that does this. However I have searched the object explorer and the documentation for version 0.64 and I cant find any reference to it.

Does anyone know if the class is missing or if there is a different meaning to "Special Class" that I'm missing?

2

There are 2 answers

3
Rup On BEST ANSWER

It looks like the Sfx class isn't built by default. Grab the source code from Codeplex (or check out the trunk code) and add conditional compile constant SFX to the project settings and rebuild. Annoyingly the signing isn't in their source control so you'll have to disable code signing for the assembly.

Alternatively if this is a one-off SFX then you can build it yourself using the files in the SevenZip\sfx directory. If you look at the SevenZipSfx soruce you'll see it simply prepends one of those files taken from the assembly resources to the .7z archive.

0
Mansour GhA On

This code works for me, packs a directory with files within:

string destination = @"c:\my test.7z";
string pathToZip = @"C:\Program Files\7-Zip\7z.exe";
string directoryPath = @"c:\my test";

ProcessStartInfo p = new ProcessStartInfo();
p.FileName = pathToZip;
p.Arguments = string.Format("a -mx=9 \"{0}\" \"{1}\" -sfx", destination, directoryPath);

Process x = Process.Start(p);

99.9% work