BABA
BABA

Reputation: 287

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

Hi I am using EPPlus to create excel in c# 2.0. I have added the reference of "EPPlus.dll" and also added

using OfficeOpenXML;

but when i am trying to run the solution its giving the follwoing error.

Error:

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

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

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

Thanks in advance..

Upvotes: 7

Views: 35464

Answers (5)

Joma
Joma

Reputation: 91

This solved the problem for me:

EPPlus missing dependency

just change the target of your project from ".Net 4.0 Client Profile" to just ".Net 4.0"

Upvotes: 9

seven
seven

Reputation: 107

Even,I had this type of error in past.So,what you have to do to solve this error. Firstly, you have check to EPPLUS.dll in bin folder.If you will not see in your bin folder than add it . secondly,if you see than ,right click on reference folder/add reference/click on browse/add EPPLUS.dll

If you don't have that download from below link:enter link description here

Upvotes: 2

Missy
Missy

Reputation: 1368

Rolling back to a prior version worked for me.

Upvotes: 3

Savangchai Saroj
Savangchai Saroj

Reputation: 23

The error was told that the epplus has an indirect reference to the windowbase 3.0 which do not included in .net framework 2.0 then i manage to find that dll located in

"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\WindowsBase.dll". thank to this question WindowsBase Version 3.0.0.0 in Global Assembly Cache

So i just referenced that dll to my project and the error was gone. this cloud be help.

Upvotes: 1

TheTechGuy
TheTechGuy

Reputation: 17364

This could happen when you migrate project from one computer to another. The solution in my case was

  1. Open the project/website in Visual Studio
  2. Save it as solution (if it is website) - important
  3. Go to Nuget for this solution. It will give you an error that some plugs are installed incorrect and needs to be restored. Click restore button but it might actually not work
  4. Check EPPLUS in the nuget, select properties and uncheck from solution to uninstall it.
  5. Reinstall it again. This should fix it.

Upvotes: 2

Related Questions