0

I want to create a sfx file with C# WinForms. I have downloaded sevensharp from https://sevenzipsharp.codeplex.com . I could not get any step by step tutorial for this. Some similar question I got from stackoverflow and other site, but all didn't work and showing error. I want to add custom from in the sfx, when user double click the "File_sfx.exe" then the custom form will be shown and ask for password.

I added "SevenZipSfx.cs" as a class, "SevenZipSharp.dll" as a reference, and copied "7z.dll" to the output folder of Visual Studio.

Sample Code:

private void button2_Click(object sender, EventArgs e)
    {
        SevenZipCompressor.SetLibraryPath("7z.dll");
        SevenZipCompressor sevenZipCompressor = new SevenZipCompressor();
        sevenZipCompressor.CompressionLevel = SevenZip.CompressionLevel.Ultra;
        sevenZipCompressor.CompressionMethod = CompressionMethod.Lzma;

        SevenZipSfx compressor = new SevenZipSfx("7z.sfx");
        compressor.MakeSfx(@"E:\cm1.7z", @"E:\cm1.exe");

    }

Error:

enter image description here

magicandre1981
  • 27,895
  • 5
  • 86
  • 127
65656565656
  • 91
  • 1
  • 12

0 Answers0