“The type or namespace name 'OfficeOpenXml' could not be found” error

佐手、 提交于 2019-12-12 03:38:41

问题


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 -

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

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.


回答1:


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.




回答2:


I solved it by removing and add EPPlus reference manually.



来源:https://stackoverflow.com/questions/32530953/the-type-or-namespace-name-officeopenxml-could-not-be-found-error

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