asp.net - EPplus assembly error -
i using asp.net 4.5 framework. downloaded epplus using nuget package. used code given @ following link.
http://epplus.codeplex.com/wikipage?title=webapplicationexample
and add following code on click event of button. after clicking button, getting following error.
could not load file or assembly 'epplus, version=3.1.3.0, culture=neutral, publickeytoken=ea159fdaa78159a1' or 1 of dependencies. located assembly's manifest definition not match assembly reference. (exception hresult: 0x80131040)
please suggest if making stupid mistake.
datatable table = new datatable(); table.columns.add("dosage", typeof(int)); table.columns.add("drug", typeof(string)); table.columns.add("patient", typeof(string)); table.columns.add("date", typeof(datetime)); table.rows.add(25, "indocin", "david", datetime.now); table.rows.add(50, "enebrel", "sam", datetime.now); table.rows.add(10, "hydralazine", "christoff", datetime.now); table.rows.add(21, "combivent", "janet", datetime.now); table.rows.add(100, "dilantin", "melanie", datetime.now); using (excelpackage pck = new excelpackage()) { //create worksheet excelworksheet ws = pck.workbook.worksheets.add("demo"); //load datatable sheet, starting cell a1. print column names on row 1 ws.cells["a1"].loadfromdatatable(table, true); //format header column 1-3 using (excelrange rng = ws.cells["a1:c1"]) { rng.style.font.bold = true; rng.style.fill.patterntype = excelfillstyle.solid; //set pattern background solid rng.style.fill.backgroundcolor.setcolor(color.fromargb(79, 129, 189)); //set color dark blue rng.style.font.color.setcolor(color.white); } //write client response.contenttype = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; response.addheader("content-disposition", "attachment; filename=exceldemo.xlsx"); response.binarywrite(pck.getasbytearray()); }
i met case solution prepared test purposes , consisted of several projects had reference epplus. problem referenced ver 4 1 project , left others older version of epplus (esp. executable 1 had older ver). result after build process folder contained older epplus , during run-time used linked project newer epplus (so project not able find proper version of epplus). after referenced same version of epplus projects, exception not thrown anymore.
Comments
Post a Comment