找不到类型或命名空间"DocumentFormat" - 仅在构建时 - 但智能感知显示类型可用



我从以下网站下载了Power Tools for Open XML:-

https://powertools.codeplex.com/

我在VS2012中打开解决方案,然后更新引用 - DocumentFormat.OpenXmlWindowsBase

问题是:-

当我开始在类顶部键入命名空间时,Visual Studio 智能感知会显示命名空间,但是当我构建解决方案时,我从使用此命名空间的所有类中收到以下错误-

The type or namespace 'DocumentFormat' could not be found.

也许其他人仍然面临问题,就像我一样。

转到 nuget 包管理器并搜索 openxml 并从那里安装。

根据您的要求和环境,您需要匹配PowerToolsOpenXML SDK 版本。

PowerTools 2.2

(现在是codeplex上的默认下载)使用OpenXml SDK 2.0附带的DocumentFormat.OpenXml2.0.5022.0版本。
此项目基于 .NET Framework 3.5 构建。

PowerTools for OpenXML 3.0 版本 3.*(也可在 https://powertools.codeplex.com/releases/view/74771 下载)使用 OpenXml SDK 2.5 附带的 DocumentFormat.OpenXml 版本 2.5.5631.0
此项目基于 .NET Framework 4.0+ 构建。

最新更新