2013-10-08 80 views
1

您好我正在使用EPPlus在c#2.0中創建excel。我已經加入「EPPlus.dll」的參考,也加入EPPlus無法找到類型或名稱空間名稱'OfficeOpenXml'(您是否缺少using指令或程序集引用?)

using OfficeOpenXML; 

,但是當我試圖運行解決方案的給予follwoing錯誤。

錯誤:

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". 

謝謝..

回答

7

這解決了這個問題對我來說:

Errors on EPPlus

剛剛從「.NET 4.0客戶端配置文件」更改您的proyect的目標只是」 .NET 4.0"

1

當你從一臺計算機遷移項目到另一個可能發生這種情況。在我的情況的解決方案是

  1. 打開項目/網站在Visual Studio
  2. 保存它作爲解決方案(如果是網站) - 重要
  3. 進入的NuGet此解決方案。它會給你一個錯誤,一些插頭安裝不正確,需要恢復。點擊恢復按鈕,但它可能實際上不是工作
  4. 檢查nuget中的EPPLUS,選擇屬性並取消選中從解決方案卸載它。
  5. 重新安裝一次。這應該解決它。
相關問題