2013-06-03 58 views
7

我在项目中添加了EPPlus和OfficeOpenXml的用法。 然而,当我跑我的项目,我得到这个错误和警告:EPPlus上的错误

警告:

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?) 

有人可以帮我指点迷津?

回答

12

问题与警告所述的一样,是EPPlus引用了不在.NET v4.0 Client Framework中的程序集(System.Web)。您可能需要定位完整的.NET v4.0而不是Client框架。

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

+0

请给我一个解决方案 – Morilog

+0

更新了解决方案。让我知道这是否有帮助。 –