This project is read-only.

The path is not of a legal form.

Oct 4, 2011 at 10:17 PM

Hi !

I have been using SevenZipSharp for a while now in some projects here at work.

We recently tried to use it in a SQL CLR Stored Procedure and it fails on the SetLibraryPath with the error mentionned above.

System.TypeInitializationException: The type initializer for 'SevenZip.SevenZipLibraryManager' threw an exception. --->
System.ArgumentException: The path is not of a legal form.     
at System.IO.Path.NormalizePathFast(String path, Boolean fullCheck)    
at System.IO.Path.NormalizePath(String path, Boolean fullCheck)     
at System.IO.Path.GetDirectoryName(String path)     
at SevenZip.SevenZipLibraryManager..cctor()  

The application perfectly works as a Console. But it fails when used as a SQL CLR Store Procedure.

Any ideas ?




Nov 13, 2013 at 7:04 PM
Edited Nov 13, 2013 at 7:05 PM
I'm currently trying to work through this issue. Is there a solution to this?

I'm using the below code to try and deploy the sevenzipsharp.dll from an embedded resource. My application fails when I try to set the 7zip.dll library path.



Nick (the name is just a coincidence)
Jan 24, 2014 at 2:50 PM
Hi guys.
I've run into this kind of issue, the last days, and it took me quite a while to find a solution.
Even if it's not a perfect one.

I had to add this line to my code
ConfigurationManager.AppSettings["7zLocation"] = sevenZipPath;

I went here after reading the source code of SevenZipSharp and I found this line:


internal static class SevenZipLibraryManager
    private static string _libraryFileName = ConfigurationManager.AppSettings["7zLocation"] ??
        Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "7z.dll");

Without the previous line the code was blowing with an exception of invalid path when I called the method bellow.
I can assure you that the path is a perfect valid path, I've a lot of verifications before calling this line, and If I get a bad path I must throw an exception . . .


From your experience do you have any ideas of other workaround ? Is it related to how I'm referencing the DLL ?
Thanks in advance for your help.