Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/324.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 当我们使用c在我的代码中使用sevenzip.dll时,获取错误运行时遇到了致命错误_C# - Fatal编程技术网

C# 当我们使用c在我的代码中使用sevenzip.dll时,获取错误运行时遇到了致命错误

C# 当我们使用c在我的代码中使用sevenzip.dll时,获取错误运行时遇到了致命错误,c#,C#,当我们使用C在我的代码中使用sevenzip.dll时,geting错误 运行时遇到致命错误。错误的地址 位于线程0x1a70上的0xdf7535b8。错误代码为0xc0000005。 此错误可能是CLR或不安全或不可验证文件中的错误 部分用户代码。此错误的常见来源包括用户 COM互操作或PInvoke的封送处理错误,这可能会损坏 堆叠 我的代码是 SevenZipExtractor.SetLibraryPath(@"D:\\Projects\\XML2U\\WindowsFormsAppli

当我们使用C在我的代码中使用sevenzip.dll时,geting错误

运行时遇到致命错误。错误的地址 位于线程0x1a70上的0xdf7535b8。错误代码为0xc0000005。 此错误可能是CLR或不安全或不可验证文件中的错误 部分用户代码。此错误的常见来源包括用户 COM互操作或PInvoke的封送处理错误,这可能会损坏 堆叠

我的代码是

 SevenZipExtractor.SetLibraryPath(@"D:\\Projects\\XML2U\\WindowsFormsApplication1\\WindowsFormsApplication1\\bin\\Debug\\SevenZipSharp.dll");
 SevenZipCompressor compressor = new SevenZipCompressor();
 compressor.ArchiveFormat = OutArchiveFormat.Zip;
 compressor.CompressionMode = CompressionMode.Create;
 compressor.TempFolderPath = System.IO.Path.GetTempPath();
 compressor.VolumeSize = 10000000;
 compressor.CompressDirectory(backupFolder, destination);

在SevenZipExtractor.SetLibraryPath调用中使用7zip.dll的路径。参见上一个问题

最好也不要硬编码该路径。您甚至不需要调用该方法,只要添加了对`SevenZipSharp'的引用,假设这两个DLL位于同一目录中,并且应该在同一目录中。