How to include the reference of DocumentFormat.Ope

2019-03-22 14:31发布

I am using C#.net Windows Desktop Application.I want to run these application with other platform also. So, i am using Mono 2.10 as a cross compiler.While running,unexpectedly my Application is terminated by saying the error message like

Error:Could not open the selected folder.
Could not load a file or assembly 'DocumentFormat.OpenXml.dll,version=2.0.5022.0, culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.

I don't know what is problem here...I have installed openxml sdk2.0 on c:\program files\open xml sdk\v2\lib\DocumentFormat.OpenXml.dll.

and also put my application eXe on on the same place for testing purpose...

Please guide me to solve this issue...

10条回答
狗以群分
2楼-- · 2019-03-22 14:54

You should also ensure you set a reference to WindowsBase. This is required to use the SDK as it handles System.IO.Packaging (which is used for unzipping and opening the compressed .docx/.xlsx/.pptx as an OPC document).

查看更多
Evening l夕情丶
3楼-- · 2019-03-22 14:54

Goto Nuget Package manager and search for openxml. And install DocumentFormat.OpenXml

查看更多
来,给爷笑一个
4楼-- · 2019-03-22 14:54

You need to have DocumentFormat.OpenXML.dll in the same folder as your application - or in the 'bin' path if you are developing an ASP.NET application. However, I'm not certain that the OpenXML SDK is supported on non-Windows operating systems - you may need to look into a third-party solution.

Yes, this answer is right, the only difference is that you copy your .dll into bin folder of the project.

查看更多
男人必须洒脱
5楼-- · 2019-03-22 14:57

After viewing and changed the properties to DocumentFormat.OpenXml, I also had to change the Specific Version to false.

查看更多
登录 后发表回答