简体   繁体   中英

Nuget package for System.Web.Hosting

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.

没有包裹

Question: where can I get this package and how?

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" />

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM