Home > Back-end >  References a .net framework dll from a .net 5 web api Could not load type System.Web.HttpContext
References a .net framework dll from a .net 5 web api Could not load type System.Web.HttpContext

Time:10-09

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

CodePudding user response:

System.Web.HttpContext only applies to .NET Framework,

https://docs.microsoft.com/en-us/dotnet/api/system.web.httpcontext?view=netframework-4.8#applies-to

So what else do you need to tell your boss?

CodePudding user response:

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://docs.microsoft.com/en-us/dotnet/standard/net-standard

  • Related