您好我正在使用EPPlus在c#2.0中创建excel。我添加了“EPPlus.dll”的引用并添加了
using OfficeOpenXML;
但是当我试图运行解决方案时,它会给出以下错误。
错误:
The type or namespace name 'OfficeOpenXml' could not be found (are you missing a using directive or an assembly reference?)
警告1:
The primary reference "EPPlus, Version=3.1.3.0, Culture=neutral, PublicKeyToken=ea159fdaa78159a1, processorArchitecture=MSIL" could not be resolved because it has an indirect dependency on the framework assembly "WindowsBase, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v2.0". To resolve this problem, either remove the reference "EPPlus, Version=3.1.3.0, Culture=neutral, PublicKeyToken=ea159fdaa78159a1, processorArchitecture=MSIL" or retarget your application to a framework version which contains "WindowsBase, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35".
警告2:
The primary reference "EPPlus, Version=3.1.3.0, Culture=neutral, PublicKeyToken=ea159fdaa78159a1, processorArchitecture=MSIL" could not be resolved because it has an indirect dependency on the framework assembly "System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v2.0". To resolve this problem, either remove the reference "EPPlus, Version=3.1.3.0, Culture=neutral, PublicKeyToken=ea159fdaa78159a1, processorArchitecture=MSIL" or retarget your application to a framework version which contains "System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089".
提前致谢..
答案 0 :(得分:7)
答案 1 :(得分:1)
将项目从一台计算机迁移到另一台计算机时可能会发生这种情况。在我的案例中的解决方案是
答案 2 :(得分:0)
错误被告知epplus有一个间接引用的windowbase 3.0,它不包含在.net framework 2.0中,然后我设法找到位于
的dll" C:\ Program Files \ Reference Assemblies \ Microsoft \ Framework \ v3.0 \ WindowsBase.dll"。感谢这个问题WindowsBase Version 3.0.0.0 in Global Assembly Cache
所以我刚刚将dll引用到我的项目中,错误消失了。这个云是有帮助的。
答案 3 :(得分:0)
回滚到以前的版本对我有用。
答案 4 :(得分:0)
我过去也曾遇到过此类错误。因此,解决该错误必须采取的措施。 首先,您要检查bin文件夹中的 EPPLUS.dll 。如果在bin文件夹中看不到,则添加它。 其次,如果看到,则右键单击参考文件夹/添加参考/单击浏览/添加 EPPLUS.dll
如果没有来自以下链接的下载:enter link description here