【发布时间】:2016-04-26 18:18:08
【问题描述】:
我正在尝试使用 ClosedXML 在应用程序中生成 excel 文档,但是当我尝试运行它时,我会收到无法加载文件或程序集服务器错误。
Could not load file or assembly 'DocumentFormat.OpenXml, Version=2.5.5631.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
我已经看到了几种解决方案,包括在其属性中更改 .dll 的“复制本地”值并将程序集直接添加到 web.config。
我使用的是 Visual Studios 2010,并且 dll 属性不包含“复制本地”条目。然后,当我在 Web 配置中输入以下程序集时,我仍然收到相同的服务器错误消息。我从提供的错误消息中得到了程序集。
<add assembly="ClosedXML, Version=0.76.0.0, Culture=neutral, PublicKeyToken=fd1eb21b62ae805b"/>
【问题讨论】:
-
我也遇到了这个错误。 Visual Studio 2017,C#,使用 Nuget ClosedXML 并更新了所有相关依赖项。在 Visual Studio 2017 开发 PC (Windows 10) 上一切正常,但是当我将版本 xcopy 到 Windows Server 2016 时失败。我没有这个问题 xcopy 到 Windows Server 2012 R2。我希望有人能弄清楚。
-
我无法让 nuget ClosedXML 在 Windows Server 2016 中工作,因为它给出了“无法加载文件或程序集...”错误。但是,当我从 github 下载 ClosedXML 的源代码并构建我的应用程序时,一切都运行良好。