我想在我的项目中实现 Ionic.Zip.dll 库。我设法让它工作,但是当我给他生成档案的选项时,它突然抛出以下错误:
Ionic.Zip.SfxGenerationException was unhandled
Message=Errors compiling the extraction logic!
有谁知道为什么会这样?这是我的代码片段,我相信这是原因,但显然我找不到任何错误。
TextWriter tw = new StreamWriter(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\temp.vbs");
// write a line of text to the file
tw.WriteLine(text);
// close the stream
tw.Close();
ZipFile zip = new ZipFile();
zip.AddFile(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\temp.vbs", "");
zip.Comment = "blabla";
SelfExtractorSaveOptions options = new SelfExtractorSaveOptions();
if (textBox1.Text != "") zip.Comment = zip.Comment + "\n\n" + "blabla: " + textBox1.Text;
if (textBox2.Text != "") zip.Comment = zip.Comment + "\nblabla: " + textBox2.Text;
if (textBox3.Text != "") options.IconFile = textBox3.Text;
options.Flavor = SelfExtractorFlavor.ConsoleApplication;
options.Quiet = true;
options.DefaultExtractDirectory = "%APPDATA%\\SomeFolder";
options.PostExtractCommandLine = "temp.vbs";
options.RemoveUnpackedFilesAfterExecute = true;
zip.SaveSelfExtractor(textBox4.Text, options);
System.Diagnostics.Process.Start(textBox4.Text);
this.Close();
感谢您期待您的帮助!
PS Ionic.Zip 可以在这里找到:http: //dotnetzip.codeplex.com/