Open XML in dnx5.0 / aspnext

蹲街弑〆低调 提交于 2019-12-13 02:17:35

问题


I'm trying to build an app that uses OpenXML in a dnx/aspnet next environment.

I've added added the OpenXML dependency to my package.json

  "dependencies": {
    ....
    "DocumentFormat.OpenXml": "2.5.0"
  }

However, when i try to run, i get this error:

The type 'Package' is defined in an assembly that is not referenced. You must add a reference to assembly 'WindowsBase, Version=4.0.0.0

It seems OpenXML depends on WindowsBase. I'm fearful that this won't work in linux/mac environment, as I can't find a nuget package or a dependency by this name.

Is there a way to add this WindowsBase .dll to a unix dnx project? Is there another way to utilize OpenXML or another word document library in unix via dnx?

Thanks


回答1:


It seems that mono has WindowsBase.dll.

Try adding a framework reference to it like in this example: https://github.com/aspnet/dnx/blob/7ac7929aa575e17b3c271e4a7a0c164418de0395/misc/XreTestApps/FrameworkReferences/project.json#L2 but use WindowBase instead of System.IO



来源:https://stackoverflow.com/questions/33584926/open-xml-in-dnx5-0-aspnext

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!