0

I am getting this error on live server when I create a excel file with format xlsx, while on local server its working fine. I had used DocumentFormat.OpenXml and ClosedXML library. Please help me to solve this issue. This is my code.

 using (XLWorkbook wb = new XLWorkbook()) { wb.Worksheets.Add(dtAgentQuery); wb.Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; wb.Style.Font.Bold = true; Response.Clear(); Response.Buffer = true; Response.Charset = ""; Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; Response.AddHeader("content-disposition", "attachment;filename=GTFKushmha.xlsx"); using (MemoryStream MyMemoryStream = new MemoryStream()) { wb.SaveAs(MyMemoryStream); MyMemoryStream.WriteTo(Response.OutputStream); Response.Flush(); Response.End(); } } 

Could not load file or assembly 'DocumentFormat.OpenXml, Version=2.7.2.0, Culture=neutral, PublicKeyToken=8fb06cb64d019a17' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

1
  • Is "not loaded" assembly in the same folder as main assembly? Commented Dec 30, 2019 at 12:27

1 Answer 1

1

The library differs between local server and live server. (other version, architecture)

You should deliver the assembly (DLL) you used in your development with the application. Check for options to do that with your IDE.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.