Eugene D. Gubenkov
Eugene D. Gubenkov

Reputation: 5357

NuGet fails to find existing package

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 the 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.

nuget package snapshot

install package failure

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

package sources

UPDATE 2. I want to highlight that it's not about some developer's machine - the same things happen 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 requests fail with the error below.

install-package intercepted http requests

Resource not found for the segment 'Packages'

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

Upvotes: 16

Views: 35945

Answers (6)

Andrew
Andrew

Reputation: 11362

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

If this does not resolve the issue, try to remove it from the NuGet config file located at

C:\Users\UserName\AppData\Roaming\NuGet\NuGet.config

Upvotes: 0

Waqas Javaid
Waqas Javaid

Reputation: 195

After 4 hours struggle I found solution here https://www.grapecity.com/componentone/docs/uwp/online-getting-started/config-nugetpackage.html

Tools > Options > NuGet Package Manager > Package Sources. > Click add button and add following one by one nuget.org https://www.nuget.org/api/v2/

GrapeCity http://nuget.grapecity.com/nuget NuGet settings in Visual Studio

Upvotes: 0

user3369534
user3369534

Reputation: 125

Clear your NuGet cache under options -> NuGet Package Manager

Upvotes: 4

bkwdesign
bkwdesign

Reputation: 2117

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.

Upvotes: 1

Banzai
Banzai

Reputation: 189

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

Upvotes: 2

Matt Brooks
Matt Brooks

Reputation: 1604

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.

Screenshot of status.nuget.org on 26 May

Upvotes: 4

Related Questions