2013-06-03 57 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

更新瞭解決方案。讓我知道這是否有幫助。 –