DLL file does not exist error...... thoughts??

Aug 3, 2012 at 12:25 PM

Hello,

I just downloaded the latest recommended version (Aug 26 2010 version) to use in my .Net 4.0 (VS 2010) application.  I added the SevenZipSharp.dll as a new Reference in my VS 2010 project.  In my C# class I added the following:

using SevenZip;

........

public void HandleRARFile(string filePath, string directory) {

    using (SevenZipExtractor extr = new SevenZipExtractor(filePath)) {

        extra.ExtractArchive(directory);

    }

}

........

When I ran the code, however, I got the following error:

SevenZip.SevenZipLibraryException: Can not load 7-zip library or internal COM error! Message: DLL file does not exist.

Not sure what I am missing with this.  Is there another DLL I need that I don't know about?

 

Thanks for any thoughts - Peter

Aug 31, 2012 at 12:15 PM

Wow, I have to say that any help on this forum is virtually non-existent.  In any case, wanted to post what I found in solving the issue on this post in case someone else runs into this.  While there seems to be ZERO documentation or "how to" information, I was able to piece together what was happening through pieces of old posts.  What I found was that you need to download the SevenZipSharp.dll and add that as a reference to your .Net VS (I am using VS 2010) project.  Then, in your code, you need to do a SevenZipExtractor.SetLibraryPath(pathToThe7z.dll) where the path you give it is to the 7z.dll (or 7z64.dll) file.  The "DLL file does not exist" error I got was due to not using the SetLibraryPath, and then my mistake was setting the path to my SevenZipSharp.dll file, which produced a "library is invalid" error.  Once I put the path to a copy of the 7z.dll file, I didn't get any error.  It would have been EXTREMELY helpful if there was something that explained that this is what was needed.

So....... I now have gotten past the initial issues but now find that my extractor.ExtractArchive(directory) call does not do anything (ie. files are not extracted to the directory). 

Aug 31, 2012 at 9:56 PM

Here is a little article to get you started:

http://talokda.wordpress.com/category/programming-2/c/sevenzipsharp/

If you need help converting this into vb.net use this website:

http://www.carlosag.net/Tools/CodeTranslator/