Nuget version not correct?

2019-01-23 12:11发布

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?

7条回答
你好瞎i
2楼-- · 2019-01-23 12:58

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.

查看更多
劫难
3楼-- · 2019-01-23 12:59

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.

查看更多
何必那么认真
4楼-- · 2019-01-23 13:01

You can also try update Nuget Package Manager directly from Tools > Extensions and Updates

enter image description here

查看更多
走好不送
5楼-- · 2019-01-23 13:03

Simply reinstall nuget in visual studio

查看更多
等我变得足够好
6楼-- · 2019-01-23 13:07

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 ToolsExtensions and Updates, on the tab Updates.

查看更多
Melony?
7楼-- · 2019-01-23 13:10

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

查看更多
登录 后发表回答