问题
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