Search code examples
c#asp.net-mvc-3nugetsharpziplibexceldatareader

Could not load file or assembly ICSharpCode.SharpZipLib... When using nuGet package ExcelDataReader


Error:

Could not load file or assembly 'ICSharpCode.SharpZipLib, Version=0.85.5.452, Culture=neutral, PublicKeyToken=1b03e6acf1164f73' or one of its dependencies. The system cannot find the file specified.`

Stack:

[FileNotFoundException: Could not load file or assembly 'ICSharpCode.SharpZipLib, Version=0.85.5.452, Culture=neutral, PublicKeyToken=1b03e6acf1164f73' or one of its dependencies. The system cannot find the file specified.]
Excel.Core.ZipWorker.Extract(Stream fileStream) +0
Excel.ExcelOpenXmlReader.Initialize(Stream fileStream) +78

[Asp.Net Mvc3 C#]

Using the NuGet Package ExcelDataReader I tried to simply open up a .xlsx file saved on the filesystem. Here is the code used:

string filePath = HttpContext.Server.MapPath("~/blank3.xlsx");
FileStream stream = System.IO.File.Open(filePath, FileMode.Open, FileAccess.Read);
IExcelDataReader excelReader = ExcelReaderFactory.CreateOpenXmlReader(stream);

Here is the website for the nuget package: http://exceldatareader.codeplex.com/

What gives? This should work without a hitch.


Solution

  • I ran into the same issue; to resolve, I found the appropriate strong-name assembly on their codeplex project.

    Downloaded the source code from http://exceldatareader.codeplex.com, grabbed the assembly from their LIB directory and referenced it from my project.

    Edit May 2021
    Looks like the link referenced is going away shortly; it's probably best (and easier) to follow Oleg's instructions below.