bp74 / Zstandard.Net

A Zstandard wrapper for .Net
Other
137 stars 27 forks source link

Throwing 'dll not found' exception when using in .NET Core 2.2 Console app. #18

Open mikemac8888 opened 5 years ago

mikemac8888 commented 5 years ago

Zstandard.Net 1.1.7 .net core 2.2

Folders x64 and x86 are added within the bin folder and each contain libzstd.dll. But for some reason I keep getting error:

Exception has occurred: CLR/System.DllNotFoundException An exception of type 'System.DllNotFoundException' occurred in Zstandard.Net.dll but was not handled in user code: 'Unable to load DLL 'libzstd' or one of its dependencies: The specified module could not be found. (Exception from HRESULT: 0x8007007E)'

class Extensions {
    public static byte[] Compress(byte[] data)
    {
        using (var memoryStream = new MemoryStream())
        using (var compressionStream = new ZstandardStream(memoryStream, CompressionMode.Compress))
        {
            compressionStream.Write(data, 0, data.Length);
            compressionStream.Close();
            return memoryStream.ToArray();
        }
    }
}