How do I reference a .NET 4.5.2 library from the .NET Core project (VS2017)

1.1k Views Asked by At

I have a .NET Core Class Library created in VS2017. I need to reference an assembly build against .NET 4.5.2. When I add the reference, I receive the following error:

Error   CS0012  The type 'Object' is defined in an assembly that is not
referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0

When I try to add the reference via VS, I can see no sources to find it:enter image description here

Similar question has been already asked here and described here but the answers described how extend the project.json file which is obsolete now and does not appear in VS2017.

1

There are 1 best solutions below

0
On
  1. Directly referencing assemblies in .NET Core applications will be supported in the 2.0 tooling that ships with the upcoming VS 2017 15.3 update. Before that, even referencing seemingly compatible dll files does not work correctly.

  2. Referencing dll files built for .NET Framework (<= 4.6.1) will only be supported in .NET Core 2.0. Lower versions do not support this scenario which is why you see this error. (In .NET Core, System.Object is not defined in mscorlib which is where .NET Framework dlls expect it to be. .NET Core 2.0 contains the necessary redirection logic.)