简体   繁体   English

命名空间系统中不存在类型或命名空间名称“HTTP”。.net 4.6.2 中的 web 错误

[英]The type or namespace name “HTTP” doesn't exist in the namespace system.web error in .net 4.6.2

I am new to .net/C#.我是 .net/C# 的新手。 I am trying to build a project but getting a lot of missing reference error.我正在尝试构建一个项目,但出现了很多缺失的参考错误。 When I am trying to install the packages like mentioned in example , I am getting error that it already exists in the project.当我尝试安装示例中提到的软件包时,我收到错误,它已经存在于项目中。

PM> Install-Package Microsoft.AspNet.WebApi.Core
Package 'Microsoft.AspNet.WebApi.Core.5.2.7' already exists in project 'XXXXXXystemApi'
Time Elapsed: 00:00:16.0349189

Also, as in below screenshot, I see that there are few references which have a little warning signs which might be pointing towards what is wrong with my setup.此外,如下面的屏幕截图所示,我看到很少有参考资料带有一些警告标志,这些标志可能表明我的设置有什么问题。

The type or namespace name 'Http' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)

在此处输入图像描述

I tried to Add references to the project but I am not seeing any entry for System.Web.Http under add reference dialog.我尝试添加对项目的引用,但在添加引用对话框下没有看到 System.Web.Http 的任何条目。

How do I fix all this?我该如何解决这一切?

Try running尝试运行

dotnet restore

in the Package Manager Console在 Package 管理器控制台中

Also, unloading and reloading the project has worked for me before (Right-click on the project name in the Solution explorer to unload and reload)此外,卸载和重新加载项目之前对我有用(右键单击解决方案资源管理器中的项目名称以卸载和重新加载)

Here is what finally solved my problem.这是最终解决了我的问题的方法。

use NuGet and downgrade a version of library you are having issue with;使用 NuGet 并降级您遇到问题的库版本; then re-install the right version.然后重新安装正确的版本。 Accept Licenses (which is probably what was needed).接受许可证(这可能是需要的)。 Important: close and reopen visual studio.重要提示:关闭并重新打开 Visual Studio。

Reference link: solution ref参考链接: 解决方案参考

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 类型或名称空间名称“ Http”在名称空间“ System.Web”中不存在 - The type or namespace name 'Http' does not exist in the namespace 'System.Web' Web API 的命名空间“System.Web”中不存在类型或命名空间“Http” - The type or namespace 'Http' doesn't exist in the namespace 'System.Web' in Web API 类型或名称空间名称“ Routing”在名称空间“ System.Web”中不存在 - The type or namespace name 'Routing' does not exist in the namespace 'System.Web' 命名空间“System.Web”中不存在类型或命名空间名称“优化” - The type or namespace name 'Optimization' does not exist in the namespace 'System.Web' .net 核心 2.2 中的命名空间“System.web”中不存在类型或命名空间名称“HttpBrowserCapabilitiesBase” - the type or namespace name 'HttpBrowserCapabilitiesBase' does not exist in the namespace 'System.web' in .net core 2.2 错误:名称空间“ System.Web”中不存在类型或名称空间名称“ Configuration” - Error: The type or namespace name 'Configuration' does not exist in the namespace 'System.Web' 错误背后是否有解释“名称空间'System.Web'中不存在类型或命名空间名称'脚本'” - Is there an explanation behind the error “The type or namespace name 'Script' does not exist in the namespace 'System.Web'” 错误 CS0234:命名空间“System.Web”中不存在类型或命名空间名称“脚本” - error CS0234: The type or namespace name 'Script' does not exist in the namespace 'System.Web' 命名空间“System.Web”中不存在类型或命名空间名称“Mvc”(您是否缺少程序集引用?) - The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?) 命名空间'system.web'visual studio中不存在类型或命名空间名称'routing' - The type or namespace name 'routing' does not exist in the namespace 'system.web' visual studio
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM