簡體   English   中英

Ionic.Zip拋出意外和奇怪的錯誤

[英]Ionic.Zip throwing unexpected and weird error

我想在我的項目中實現Ionic.Zip.dll庫。 我設法讓它工作,但當我給他選項生成一個存檔時,它突然拋出以下錯誤:

Ionic.Zip.SfxGenerationException was unhandled
Message=Errors compiling the extraction logic!

有誰知道為什么會這樣? 這是我的代碼snipet,我相信是原因,但顯然我找不到任何錯誤。

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/

我收到此錯誤,並獲得一個奇怪的.cs文件生成在我期待的.exe文件的位置(此異常添加此文件的路徑)。 我用文本編輯器打開了這個文件(DotNetZip-2018May30-150547-7b57e3d0-9c8e-402a-9da8-bda23ee8100c.cs),最后是一個錯誤。

對我來說這是一個權限問題,請確保它可以創建exe文件。

我的工作正在創建一個拉鏈但不是exe

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM