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.
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.
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.
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.
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.
Clear your NuGet cache under options -> NuGet Package Manager
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
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.
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
Right click on references in your project
Manage NuGet Packages => All
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
Related
I have made Python discord bots in the past with discord.py but now I am learning C# and I want to try to make one with discord.net. When I try to install discord.net - I click on dependencies, then NuGet packages, and then browse and search up discord.net. When I press the install button, I get the following error:
Severity Code Description Project File Line Suppression State
Error Failed to retrieve information about 'Discord.Net.Core' from remote source 'https://github.com/DSharpPlus/DSharpPlus/FindPackagesById()?id='Discord.Net.Core'&semVerLevel=2.0.0'.
Response status code does not indicate success: 404 (Not Found).
I am using Visual Studio 2019.
The issue is that you have used a private nuget feed. In that feed, you have Discord.Net nuget package but some of its nuget dependencies such as Discord.Net.Core do not exist in your private feed. This is the cause of the problem. Remember that nuget dependencies are installed together with the nuget main package. If there is a problem with installing the dependencies, the main package cannot be installed in the project.
So I suggest you should use nuget.org nuget package source.
Suggestion
1) Tools-->Nuget Package Manager-->Package Manager Settings-->Package Sources
check nuget.org source and if your VS did not have it, you can add like this.
2) then under manage nuget packages UI, please select nuget.org to install that package.
============================================
Update 1
Close VS, delete nuget.config under C:\Users\xxx(current user)\AppData\Roaming\NuGet.
Then, restart VS and then installing nuget packages work well.
I am trying to make Newtonsoft.json available for use in my local Visual Studio 2010 projects. I installed NuGet.Tools on my system. Now I see an item in the Solution Explorer called Service References that wasn't there before, but I don't understand how to use that to reference the Newtonsoft package I also downloaded, which is currently in my Downloads folder. Do I need to move the package to a different location to reference it?
Thanks for your help.
You can right click on the project where you want to install newtonsoft nuget package.
You will find an option "Manage NuGet packages".
Then search online for "newtonsoft".
This would add a packages.config file in your project (depending on which framework you are targeting to ).
this new file contains all the nuget dependencies required for this project.
Refer this blog for more details
VS2010 is old and is unable to update to the latest NuGet version. This means that adding recent packages will often fail; however, you can often add an older version of a package that has a compatible NuGet version and it will work. This causes the suggested answer by #ManojChoudhari to fail for me. In the case of Newtonsoft.Json, the following worked using the Package Manager Console:
Install-Package Newtonsoft.Json -Version 9.0.1
I got an error
NuGet package restore failed. Please see Error List window for detailed warnings and errors.
while building my solution. Package manager can't restore my 2 projects:
Unable to find project information for 'C:\(...)\MultiLinker.Courier.Dext.Model.csproj'. The project file may be invalid or missing targets required for restore.
In tools I allow package manage to download packages:
Ran into the same issue. In my case, it was because Visual Studio only had the Offline Package source and could not resolve the packages I needed. I added in the nuget.org source as shown below in the NuGet Package Manager settings and right clicked on the solution and selected restore packages. and it resolved the issue.
open Nuget Package Manager -> Package Source > Add https://nuget.org/api/v2
I might be forgetting some steps, but a crucial step for me to fix this was running nuget restore from the commandline (Trying to restore from Visual Studio UI was not sufficient for some reason).
I also added a plugins folder given to me by a teammate to my .nuget folder that supposedly makes it handle our credentials automatically, so if you are having this issue maybe that is something you are missing as well.
In my case it was my Company DevOps credentials being out of date
Account Settings > Change credentials in the dialog that opens
On Visual Studio Code (VSCode) this can be solved this way:
dotnet new nugetconfig
thank you it works fine
and solved all issues of nuget
by creating the new value in the setting of nuget
under tools > nuget package manger > package manger settings
nuget package sources
add new value nuget.org and https://www.nuget.org/api/v2/
then save and update you project
it will work
The nuget restore did not work for me but once I used nuget.org it worked just fine. This was the best solution for me.
Upgrading my out of date Visual Studio helped for me:
Help Menu: Check for Updates...
I am unable to install a package pushed to company source. In package manager I see the correct most up-to-date version but when I try to install it I get an error:
Package 'xxxx' is not found in the following primary source(s): 'https://company/nuget/v2/index.json,https://www.nuget.org/api/v2/'. Please verify all your online package sources are available (OR) package id, version are specified correctly.
The situation is strange because my colleagues are capable of installing this very package for the same project on their machines on the same version of code.
I resolved the error by removing ".vs" folder from the solution.
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
I have a project that i cannot compile. When i try to do so I get the following error:
The 'Microsoft.Bcl.Build 1.0.14' package requires NuGet client version '2.8.1' or above, but the current NuGet version is '2.7.41115.310'.
Normally this would be simple. After searching I found this guide:
http://www.daimto.com/package-requires-nuget-client-version-x/
That explains how I can upgrade my Nuget client version. However, when i follow those steps, I find that I am already using the latest version of Nuget: 2.8.5
For some reason however, Visual Studio 2013 Ultimate is using an older version, and I don't understand why.
My install of Visual Studio Ultimate 2013 is a fresh install, after unninstalling Visual Studio for Web Express 2012. The previous version was giving me a considerable amount of problems and so I deleted it and moved on to 2013. I wonder if some cofig files were passed through, but I cant be sure.
How can I fix this problem?
From Tools → Extensions and Updates → Installed, uninstall “NuGet Package Manager” and install it again.
So, after searching around I found no answers, so I decided to look into the project folders. It happens that I have the main version of NuGet.exe, 2.8.5 in main folder, but the project was nowhere near that main folder.
This way, when I downloaded the project it simply used the NuGet version pulled from TFS (or so I assume), and that was the problem - that verison was Nuget.exe 2.7.4.
After replacing the "Nuget.exe" files (found in /.nuget folder of the project) the project finally compiled and everythign started working again.
You can also try update Nuget Package Manager directly from Tools > Extensions and Updates
In my case, a pending update of Visual Studio fixed the nuget version.
The update was the "Update 5" for VisualStudio 2013.
The update was listed under the menu Tools → Extensions and Updates, on the tab Updates.
I was getting this error from a recently cloned branch, but (in contrast to the above solution) found that my Nuget version in the project directory was the same as that in my solution directory.
I solved this by right clicking on the solution and Managing Nuget Packages for the solution. The Nuget dialog that popped up said that packages were missing and asked me to restore them. Once downloaded, the project built successfully.
I had the same issue when trying to install System.Net.Http and it said the nuget version needed to be version 3.0 or above. I tried few things but in the end, used Tools and Manage Nuget Packages and did a search and tried to install it from there when it said exactly the same thing - wrong version of nuget, but it popped up with an upgrade Nuget button too!
Hope this helps someone
Simply reinstall nuget in visual studio