I've downloaded ExcelDataReader from the Visual Studio Package Manager Console and followed the C# instructions on its Code Plex page http://exceldatareader.codeplex.com/, but, during run-time, I get an "ExcelReaderFactory.cs not found" message when the code fails at the ExcelReaderFactory. The entirety of my code block is below.
I've tried removing and reinstalling the Nuget package and searching for hours, coming upon an answer from this site: ExcelReaderFactory.cs not found. I tried catching a possible exception, but none was caught in my code. Is the exception only in the ExcelDataReader source code, to which I do not have access, and not in my code? What is the solution to this error? Thanks very much in advance.
[HttpPost]
public ActionResult UploadForecasts(HttpPostedFileBase ForecastsFile)
{
try
{
string myPath = "C:\\Uploads\\" + ForecastsFile.FileName;
ForecastsFile.SaveAs(myPath);
System.IO.FileStream stream = System.IO.File.Open(myPath, FileMode.Open, FileAccess.Read);
IExcelDataReader ForecastsReader = myPath.Contains(".xlsx")
? Excel.ExcelReaderFactory.CreateOpenXmlReader(stream)
: Excel.ExcelReaderFactory.CreateBinaryReader(stream);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}