0

In a legacy project I am working on, there is a using directive:

using System.Web.Hosting

I supposed, that the nuget package name should be System.Web and tried to install it via Nuget.

But there's no such package.

no package

Question: where can I get this package and how?

Rafael
  • 1,281
  • 2
  • 10
  • 35

2 Answers2

1

System.Web is not a nuget-package, it's a framework reference and System.Web.Hosting is one of the namespaces located in System.Web

Depending on your project-type, whether it's the old or new format, you have to do the following

For old format:

  1. Locate the project and collapse it
  2. Right click on "References" and press on "Add reference"
  3. In the window that pops choose the menu on the left named "Assemblies" and then search for "System.Web"

For new format:

  1. Right click on the project and press on "Edit"
  2. Find an existing <ItemGroup> or add a new one
  3. Add this line <Reference Include="System.Web" />
alsami
  • 8,996
  • 3
  • 25
  • 36
0

I did not know that System.Web is not available for .netstandard projects. And my project is a .netstandard project (migrating from .net framework).

This is the reason why the System.Web package is not available. I think it would be far more better, if unavailable packages would be displayed, but with message, that they are not availble for a particular reason.

Otherwise users spend much time to finding out the reason of such issue.

Rafael
  • 1,281
  • 2
  • 10
  • 35
  • You are absolutely right, but not speaking in the right forum. I would vote for your answer but it does not answer the question of the topic. I would advise you to post your question directly to [Microsoft forums](https://developer.microsoft.com) and there people can vote, so Microsoft has visibility on the matter and actually take some changes towards it. – Fábio Oct 30 '20 at 15:22