Click here to Skip to main content
15,921,941 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Could not load file or assembly 'DocumentFormat.OpenXml, Version=2.0.5022.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

I found this to be an issue when the reference was in a class library included as a reference in the Web Application Project being published. Even when CopyLocal was changed to True the file was not copied to /bin when publishing.

I added the reference to the Web Application Project being published as well, even though it isn't used there, set CopyLocal to True there as well and the file was included when publishing.

Other DLLs copied fine when only referenced in the class library. Not sure why this one is different.
Share this answer
If More than one user working on the same project and both of them Moving the bin to server(where the application is Host) then this issue may happen due to vesion mismatch
of the Third party ddl of the system of the develpoers .

So you both need to move all the third party dll along with the application dll to server to resolve the Issue.

If you are facing the Issue at you local system then remove the third party ddl and add it once again and rebuild the solution

keep smiling :):):) happy coding:)
Share this answer
Patel Shailendra 6-Dec-12 2:55am    
yes u r right i have solve this problem yesterday.
By the way thanks a lot for reply.
My +5... Awesome explanation.
IpsitaMishra 7-Dec-12 6:00am    
thanks a lot :)
Most welcome... Anytime.
Your application must compiled with Open XML SDK 2.0 for Microsoft Office[^]
Share this answer
honda15i 11-Jun-14 3:06am    
SDK Installation solved my problem

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900