-1

I'm building a class library with some utility functions that any of my projects can access. I need to be able to use some classes within the System.Net namespace, like WebHeaderCollection. Unfortunately, Visual Studio doesn't find them, and doesn't give me the option to resolve them by adding the correct using directive.

Not even after explicitly having added System.Net does it find the reference. What am I doing wrong?

enter image description here

UPDATE:

I solved the problem. I had created a Class Library (Package) (used for NuGet, where you edit the references in project.json instead of going the Add Reference... route). This time I created a regular Class Library (in the Windows category) instead and references now work like a charm.

enter image description here

silkfire
  • 24,585
  • 15
  • 82
  • 105

1 Answers1

0

Check the documentation. That object is in the System.Net.Requests assembly:

enter image description here

Jonesopolis
  • 25,034
  • 12
  • 68
  • 112
  • I'm getting "The type or namespace name 'Requests' does not exist in the namespace 'System.Net' (are you missing an assembly reference?)" – silkfire Sep 01 '15 at 20:33
  • 1
    you'll need to add a reference to`System.Net.Requests` – Jonesopolis Sep 01 '15 at 20:34
  • Which I also did, but can you see the illogical error I'm getting? – silkfire Sep 01 '15 at 20:38
  • you should just need to add a reference to `System.Net.Requests` in your project, and a `using` statement to `System.Net` and you'll be all set. What's the issue? – Jonesopolis Sep 01 '15 at 20:44
  • VS is not recognizing this. Maybe it's because I created a Class Library (Package) instead of a normal Class Library? This one's maybe only to create NuGet packages, which is not my purpose. Let me try again – silkfire Sep 01 '15 at 20:46