NuGet fails to find existing package

孤街醉人 提交于 2019-12-04 02:56:03

问题


How it's possible that NuGet's Install-Package fails with Unable to find version 'x' of package 'y' when that exact version is released as NuGet to official repository and it shown on the https://www.nuget.org/packages/y page.

Here is specific sample with nuget.org content and NuGet Install-Package command output.

UPDATE. Package sources are set to defaults (from nuget.org). Actually you can see the issue just running Install-Package Log4Net.Async -Version 1.3.0.

UPDATE 2. I want to highlight that it's not about some developer's machine - the same things happening on Visual Studio Online Hosted Build Controller.

UPDATE 3. Here is how NuGet tries to load package and it looks like NuGet API just broken, because all these request fails with the error below.

Resource not found for the segment 'Packages'

Also NuGet produces the strange output on NuGet API calls that issues at VS search packages stage, please see here: http://pastebin.com/qveadrZB.


回答1:


NuGet currently has some service issues related to search and package restore functionality. It is possible this is the cause of your package restore failure.

If other dev machines are working OK, it's likely they have access to a cached version of this package.




回答2:


I know this thread is very old, but someone who has this problem like me in these days, find my solution for solving such problem here.

I've installed Visual Studio 2012/2015/2017 parallel, and 2012 failed with "package not found error". So I take a look in the NuGet-settings in VS2017 and found the following package resource:

https://api.nuget.org/v3/index.json

I just added this location to the package resources and vòila, the searched packages where found and installed (in my example the HtmlRenderer).

But be careful with compatibility to Framework 2.0! This setting breaks maybe the functionality to version 2.0!!

Hope this helps someone sometimes somewhere.

Greetings




回答3:


  1. Right click on references in your project
  2. Manage NuGet Packages => All
  3. Uninstall affected packages

    if this will not resolve the issue, try to remove it from NuGetConfigFile located at C:\Users\UserName\AppData\Roaming\NuGet\NuGet.config




回答4:


I'm a latecomer to this thread... I'm in Visual Studio 2017 - 15.9.4

I got this error today trying to pull from my private DevOps NuGet feed

CONTEXT: the first time I called Install-Package everything worked, but, my NuGet was not assembled right, so, I re-published the NuGet pkg, and when I tried to update my project that was consuming the pkg, that's when I got the failure)

Switching my Package Source to "all" alleviated the problem.



来源:https://stackoverflow.com/questions/30464558/nuget-fails-to-find-existing-package

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!