The packaged Open XML DLL v2.5 is not compatible, expected is DLL version 2.0.
The solution is to copy the correct Open XML DLL to the project directory. To do so:
No need to install the SDK. Extract the msi archive with the following command (absolute paths):
msiexec /a d:\somedir\someinstaller.msi /qb TARGETDIR=c:\temp
Copy file "DocumentFormat.OpenXml.dll" from extraction "c:\temp\Global Assembly Cache Folder\DocumentFormat.OpenXml\2.0.5022.0_31BF3856AD364E35" to project directory
Done.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank you for the instructions. As the download link to Microsoft is broken and the author of this SW seems to have vanished, I created an archive with that older OpenXML2.0 included: https://mega.nz/file/7ZlmyaKA#6alUubl__VBYKgjpqy9aqhQiMMqkIUM82utbrIRfN4Y
Checksum MD5: 48E84D22889D3D22F3308359DC1DEF62
Thank you! I performed the steps, and it resolved the issue in the screenshot.
Here is the "loose" text of the error message (in case the image is not yet machine-readable/OCR)
Failed to create excel from the datasetCould not load file or assembly 'DocumentFormat.OpenXml, Version=2.0.5022.0, Culture=neutral, PublicToken='31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi, I am having the same problem exporting to Excel. Is there a solution?
The packaged Open XML DLL v2.5 is not compatible, expected is DLL version 2.0.
The solution is to copy the correct Open XML DLL to the project directory. To do so:
https://www.microsoft.com/en-us/download/details.aspx?id=5124
msiexec /a d:\somedir\someinstaller.msi /qb TARGETDIR=c:\temp
Thank you for the instructions. As the download link to Microsoft is broken and the author of this SW seems to have vanished, I created an archive with that older OpenXML2.0 included:
https://mega.nz/file/7ZlmyaKA#6alUubl__VBYKgjpqy9aqhQiMMqkIUM82utbrIRfN4Y
Checksum MD5: 48E84D22889D3D22F3308359DC1DEF62
PS: Manual Download of th OpenXML2.0 currently available here from MS: http://download.microsoft.com/download/2/7/F/27FF6744-D970-4FFB-90B8-5226B2B82E0A/OpenXMLSDKv2.msi
Last edit: commander_keen 2021-08-26
Thank you! I performed the steps, and it resolved the issue in the screenshot.
Here is the "loose" text of the error message (in case the image is not yet machine-readable/OCR)
Failed to create excel from the datasetCould not load file or assembly 'DocumentFormat.OpenXml, Version=2.0.5022.0, Culture=neutral, PublicToken='31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)