Search code examples
c#asp.net-core-webapi.net-5

References a .net framework dll from a .net 5 web api Could not load type System.Web.HttpContext


We have quite a lot .net framework dlls (no control over) that will never be updated/ported to .net core/5/6

  1. Can a .net5/6 web api reference a dll on the .net framework that contains System.Web/web services?

  2. In short if I wrap all the calls in a .NET Framework dll that is called by a .net 5 web api - will it work?

I tried something and I got an error

Could not load type System.Web.HttpContext

Where can I find an official document that I can give my boss that says this is not possible?

Many thanks


Solution

  • You can tell your boss that if you convert the dlls to .net standard 2.0, then you can use the dll in both .net and .net5 projects.

    Here is the official documentation https://learn.microsoft.com/en-us/dotnet/standard/net-standard