7

我在我的项目中添加了 EPPlus 和 OfficeOpenXml 的使用。但是,当我运行我的项目时,我会收到以下错误和警告:

警告 :

The referenced assembly "EPPlus" could not be resolved because it has a dependency on "System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which is not in the currently targeted framework ".NETFramework,Version=v4.0,Profile=Client". Please remove references to assemblies not in the targeted framework or consider retargeting your project.

错误:

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

有人可以帮我弄清楚吗?

4

1 回答 1

13

就像警告所说的那样,问题在于 EPPlus 引用了一个System.Web不在 .NET v4.0 客户端框架中的程序集 ( )。您可能希望针对完整的 .NET v4.0 而不是客户端框架。

更新这有关于更改项目目标框架的分步说明:http: //msdn.microsoft.com/en-us/library/vstudio/bb398202.aspx在您尝试引用 EPPlus 的项目中,而不是.NET 4.0 客户端配置文件,选择 .NET 4.0。

于 2013-06-03T23:58:56.873 回答