“无法找到类型或命名空间名称”OfficeOpenXml“错误 [英] "The type or namespace name 'OfficeOpenXml' could not be found" error

查看:3080
本文介绍了“无法找到类型或命名空间名称”OfficeOpenXml“错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用EPPlus来生成Excel文档。代码在我的本地系统中构建成功,但是当我们通过TeamCity构建并获得低于错误时,代码失败 -

We are using EPPlus to generate Excel documents. Code builds successful in my local system but it is failing when we build through TeamCity and getting below error -


错误CS0246:类型或命名空间找不到名称OfficeOpenXml(您是否缺少using指令或程序集引用?)

error CS0246: The type or namespace name 'OfficeOpenXml' could not be found (are you missing a using directive or an assembly reference?)

我试过Google找到解决方案却全然无用。我的项目目标框架是4.5.2,我也添加了System.Core和WindowsBase。我还添加了使用OfficeOpenXml的命名空间
通过Nuget软件包添加EPPlus。

I have tried Google to find the solution but all in vain. My Project target framework is 4.5.2 and I have also added System.Core and WindowsBase. I have also added namespace "using OfficeOpenXml" EPPlus is added through Nuget Package.

推荐答案

如果您有任何软件包使用NuGet安装,那么您需要在实际构建命令之前,在构建配置中添加一个NuGet Installer构建步骤,使用引用所需的NuGet软件包的解决方案文件。这一步是什么导致TeamCity下载任何需要安装的NuGet软件包。

If you have any packages installed using NuGet, then you need to add a NuGet Installer build step in your build configuration before the actual build command, using the solution file which references the NuGet packages you need. This step is what causes TeamCity to download any NuGet packages that are required that it doesn't have installed.

这篇关于“无法找到类型或命名空间名称”OfficeOpenXml“错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆