Using system.net throws an error

I am currently trying to create a new Grasshopper plugin. When I try using Sytem.Net and System.Net.Sockets the following error gets throw. How can I resolve this? (I already tried importing System.net.primitives with the NuGet package manager)

{
  Exception has been thrown by the target of an invocation.
  TargetInvocationException
}

Object: GHNetwork (level 2)
{
  Could not load file or assembly 'System.Net.Primitives, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
  FileNotFoundException
}

Looks like you’re targeting .NET 5; this is not supported in Rhino/Grasshopper. You should use .NET 4.8.