简体   繁体   English

NuGet 包搞砸了项目

[英]NuGet package messed up project

I installed this NuGet package through the Package Manager Console.我通过包管理器控制台安装了这个NuGet 包。 It messed up my project and since System.Net.Http is missing so it is impossible to build my ASP MVC WebApi project anymore.它搞砸了我的项目,因为System.Net.Http丢失,所以不可能再构建我的 ASP MVC WebApi 项目。

I tried removing references to System.Web.Http.WebHost.dll from the project and adding the previous one (that used to work) and regardless of which I used now, the Http part of the namespace can't be found.我尝试从项目中删除对System.Web.Http.WebHost.dll引用并添加前一个(曾经可以工作),无论我现在使用哪个,都找不到命名空间的Http部分。

Have you ever had this problem ?你有没有遇到过这个问题? I read trashing the project and starting from scratch solved it for others, but that's not really a solution in my book.我读过破坏项目并从头开始为其他人解决它,但这并不是我书中真正的解决方案。

Any ideas ?有任何想法吗 ?

Try to run this in Package Manager Console:尝试在包管理器控制台中运行它:

Update-Package Microsoft.AspNet.WebApi.Cors -Reinstall

If you get any errors, comment below.如果你有任何错误,请在下面评论。

I trashed the project and restarted a new one (Web API).我丢弃了该项目并重新启动了一个新项目(Web API)。 I'm just drag and dropping class files back in the new one.我只是将类文件拖放到新的文件中。

It wasn't under source control.它不受源代码控制。 That'll teach me.那会教我的。

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

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