0

I'm trying to add NPOI to a dotnet core library targeting netcoreapp1.1.
I'm able to add to the project, but if I add this line of code

wb = new XSSFWorkbook(inputStream);

I have this error message

Reference to type 'FileInfo' claims it is defined in 'mscorlib', but it could not be found

these are the packages added to the project

Microsoft.NETCore.Portable.Compatibility Version="1.0.2" 
NPOI Version="2.3.0" 
System.ComponentModel.TypeConverter Version="4.3.0"

Is there a way to fix this problem?

Luca Morelli
  • 2,530
  • 3
  • 28
  • 45

1 Answers1

0

This error occurs when a library that was built for .NET Framework is loaded on .NET Core < 2.0.

.NET Core 1.0 and 1.1 can only load libraries that were built for .NET Standard (<= 1.6) or .NET Core (respective versions).

.NET Core 2.0 (in preview at time of writing) will have type forwarding assemblies that make a lot of .NET Framework assemblies work, but does not guarantee that all libraries will work unchanged.

Martin Ullrich
  • 94,744
  • 25
  • 252
  • 217
  • I previously added the list of packages, but SO was hiding them thinking were html tags. Microsoft.NETCore.Portable.Compatibility and System.ComponentModel.TypeConverter helps to fix this kind of problems. I was looking for some other package to fix this problem – Luca Morelli May 26 '17 at 21:07
  • the portable compatibility library enables a few PCL profiles for .net core, but there is no package that enables all .NET Framework code. I suggest you try the .NET Core 2.0 preview and see if that helps. It has a mscorlib.dll with a lot of type forwarders. – Martin Ullrich May 27 '17 at 06:02