繁体   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