[英]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.