5

I'm working on a .NET Core 2 application, I have a Nuget package that I need that is only written in Framework 4.6. I've downloaded the Nuget package and initially there are no problems with creating an Instance of the class.

However when I try to use one of the methods I get an error in VS 2017 saying "Reference to type '' claims it is defined in 'System.Web', but it could not be found" , "Module 'System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' should be referenced".

I've read several posts saying that it may not be possible to reference System.Web.dll which is needed.

However I've also seen these:

Using external .dll in dot net core

.net core 1.0 visual studio referencing external dll

I've tried adding it as a reference to the project as well as using Nuget Package Explorer to create a Nuget package with System.Web in it.

Can I solve this issue by correctly referencing the System.Web.dll or is this not possible in .NET Core 2?

Camilo Terevinto
  • 31,141
  • 6
  • 88
  • 120
Braden Brown
  • 3,111
  • 1
  • 20
  • 18

1 Answers1

5

It is not possible to use APIs of the System.Web namespace / dlls in .NET Core 2.

While it is possible to use .NET Framework NuGet packages and DLLs, this compatibility layer is only a best-effort approach and may fail if the external code tries to use APIs that are not available in .NET Core, such as types in System.Web.

Martin Ullrich
  • 94,744
  • 25
  • 252
  • 217