Nuget包...项目中不存在...包...文件夹中已存在 [英] Nuget Package ... does not exist in project ... Package ... Already exists in folder

查看:85
本文介绍了Nuget包...项目中不存在...包...文件夹中已存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经为这个错误解决了好几个小时,无法提出一个可行的解决方案.

I've been fighting with this error for several hours and can't come up with a solution that works.

我在一个多项目解决方案中有一个ASP.Net API,该API的引用/依赖项配置不正确,并且我一直在尝试修复它两天.

I have an ASP.Net API within a multi-project solution which has its references/dependencies improperly configured and I've been trying to fix it for two days.

问题是(我相信)该API缺少System.Web.Http/System.Web.Http.WebHost,它显然包含在Microsoft.AspNet.WebApi.Core中(按多个其他堆栈溢出问题).尝试通过Nuget安装它时,在尝试解决依赖关系时出现以下错误.此外,我每次都会收到此错误(请参阅此问题稍后的故障排除):

The issue is (I believe) that the API is missing System.Web.Http / System.Web.Http.WebHost which apparently is included with Microsoft.AspNet.WebApi.Core (per multiple other Stack Overflow questions). When trying to install it via Nuget I get the following error when attempting to resolve the dependency. Further I've gotten this error every time (see my troubleshooting later in this question):

我以不特定的顺序执行了以下步骤(每次以不同的组合多次):

I've done the following steps in no particular order (multiple times each in various combinations):

  • 运行更新程序包Microsoft.AspNet.WebApi.Core-重新安装"
  • 删除解决方案范围的"Packages"文件夹,并删除项目的packages.config,并尝试还原软件包
  • 从物理驱动器和TFS删除整个项目,然后从头开始重新创建它(它创建的引用不正确)
  • 通过命令行和Nuget GUI安装软件包
  • 将解决方案检出到硬盘上的不同位置,以尝试尽可能新鲜地开始
  • 重新启动计算机/重新启动Visual Studio

在这一点上,我可以采用不干净的修复程序,只要它可以修复它.该API在某一时刻可以正常工作,但是后来我将其检入到TFS中,创建了一个分支,现在正在该分支上工作.可能不包括某些依赖项(?),但即使是这种情况,看来我已采取的步骤也可以解决问题.

At this point I'm fine with a non-clean fix, as long as it fixes it. The API was working at one point, but then I checked it into TFS, created a branch, and am now working on the branch. Possibly some dependencies weren't included (?) but even if this was the case it seems like the steps I've taken should resolve the issue.

推荐答案

关闭解决方案,然后转到硬盘驱动器上的packages文件夹并删除其所有内容.在Visual Studio中再次打开您的应用程序,它将自动尝试还原包.清洁解决方案并构建它.

Close the solution then go to the packages folder on your hard drive and delete all its contents. Open your application again in Visual Studio and it will automatically try to restore the packages. Clean the Solution and Build it.

这篇关于Nuget包...项目中不存在...包...文件夹中已存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆