Package requires NuGet client version ... or above - c#

After I download my project from GitHub and try to compile it I am running into the issue of "package requires NuGet client version ... or above" but I am using Visual Studio 2017 with the latest NuGet version for that version. The issue is fixed after building the package twice but is there a way that I could stop this from happening in the first place and have it so that these issues go away after the first compilation of the code?

I had a similar problem while adding NUnit via Nugget Manager. Instead of adding the package via Nuget Manager, I downloaded the framework's dll files from their website and add them as a reference to the project.
If you still want to use the NuGet manager, you have to upgrade to a newer version of Visual Studio

Related

Emgu error when trying to install emgu.CV.runtime.windows in VC# 2017

I'm trying to install emgu.CV.runtime.windows from within Visual Studio 2017, and installing by the recommeded method of right-clicking references and installing via NuGet.
However I am getting the error below.
Could not install package 'Emgu.runtime.windows.msvc.rt.x64 19.28.29336'. You are trying to install this package into a project that targets .NETFramework,Version=v4.7.2, but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
According to the package information, its dependencies are
enter code here.NetStandardVersion=2.0
enter code here.Engu.CV (> 4.5.1 && < 4.5.2)
enter code here.Engu.runtime.windows.msvc.rt.x86 (= 19.28.29336)
enter code here.Engu.runtime.windows.msvc.rt.x64 (= 19.28.29336)
I checked and c:\windows\Microsoft.NET\Framework contains a folder for v2.0.50727, so it seem .net 2.0 is installed (as is v3.0, v3.5, v4.0.30319)
I have emgu.CV 4.5.1.4349 installed.
I need this library so that I can have the enter code herebitmap.ToImage<Bgr, byte>(); function.
Why am I getting this error?
Any help would be greatly appreciated.
The solution is migrating from package.config to package references for every project you have. Simply right click on package.config and click "migrate package.config to PackageReference".
Then, install the runtime package again and it will work.
For the new Emgu Nuget package you do need to use PackageReference instead of the traditional package.config.
What worked for me on Visual Studio 2017:
Uninstall all NuGet Packages [This removes the package.config file]
Go to Tools --> Options --> NuGet Package Manager --> General
Change the default package management format to "PackageReference"
Check "allow format selection on first package install"
Click OK
Install Emgu.CV, Emgu.CV.Bitmap, Emgu.CV.UI and Emgu.CV.runtime.windows
These Emgu packages should now appear under your references and you should not see a package.config file.
Nuget Options Image
I encountered the same error. I don't know why we're getting it, but I was able to find a workaround.
Visit the nuget page for the package.
Click "Download Package" to download the nuget package directly.
Open the downloaded file using your archive utility of choice and navigate to the "\runtimes\win-x64\native" folder.
Copy both dll files into the output directory of your project.
After doing this, my code executed without error. Make sure to install emgu.CV.Bitmap as well.
I changed my projects Target Framework to ".NET Framework 4.6" and then went to "Manage NuGet Packages", selected "Browse", typed in "emgu.cv.runtime" then installed version 4.5.1.4349 and it worked.
Here is how I solved it,
1- downgrade .Net framework to 4.6 from project properties
2- Uninstall Emgu.CV and related ones (you will see which ones needed to be uninstalled in Errors List)
3- Install Emgu.CV.runtime.windows from Solution Nuget Manager ( it should install fine now)
3- upgrade .Net framework to 4.8
4- install Emgu.CV 4.5.1 (latest)
5- install Emgu.CV.UI 4.5.1 (Emgu.CV.Bitmwp was installed automatically for me)
and that's it, now you can use bitmap.ToImage<Bgr,Byte>(), note that the Image<Bgr,byte>(bitmap) doesn't work anymore.

How do I install Newtonsoft.json for Visual Studio 2010?

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

Cannot find Math.net in References after installing package with NuGet in Visual Studio 2015

I'm trying to use the Math.net extension for Visual Studio 2015 with C#.
Unfortunately, after installing the package with
PM> Install-Package MathNet.Numerics -Version 3.20.0
I cannot find it anywhere in the Add References menu. I searched Assemblies->Framework and Assemblies->Extensions and COM, but it's not there
I wouldn't mind the just adding the DLL to my project, but I cannot find the DLL anywhere on https://numerics.mathdotnet.com , all the links take me to the NuGet package manager.
Also, do I need to distribute the MathNet dll with my application if I add it through the package manager, or does it build internally with the application?
Sorry, new to .net library management
I see that when I ran the command line, it added a packages folder to my project folder. Which has a few different versions of the library per .net version. Which I could browse to with Add Reference->Browse->Browse
Is this the correct way about adding a third party library?

Package requires NuGet client version '2.12'

I am trying to install 'WindowsAzure.Storage 8.0.1' in visual studio 2012, but getting the error
package requires NuGet client version '2.12' or above, but the current NuGet version is '2.8.60318.667'.
on running command "Install-Package NuGet.Client"
Attempting to resolve dependency 'NuGet.Versioning (≥ 3.5.0)'.
Attempting to resolve dependency 'NuGet.Packaging (≥ 3.5.0)'.
Attempting to resolve dependency 'NuGet.Common (≥ 3.5.0)'.
Attempting to resolve dependency 'NuGet.Packaging.Core (≥ 3.5.0)'.
Attempting to resolve dependency 'NuGet.Packaging.Core.Types (≥ 3.5.0)'.
Attempting to resolve dependency 'NuGet.Frameworks (≥ 3.5.0)'.
Attempting to resolve dependency 'NuGet.Repositories (≥ 3.5.0)'.
Attempting to resolve dependency 'NuGet.RuntimeModel (≥ 3.5.0)'.
Attempting to resolve dependency 'Newtonsoft.Json (≥ 6.0.4)'.
Attempting to resolve dependency 'NuGet.ContentModel (≥ 3.5.0)'.
'NuGet.Client 3.5.0' already installed.
But still I am getting the error.
The 'WindowsAzure.Storage 8.0.1' package requires NuGet client version '2.12' or above, but the current NuGet version is '2.8.60318.667'.
Update your NuGet Package Manager extension. Go to Tools->Extensions and Updates and select Updates->Visual Studio Gallery. Update the NuGet Package Manager extension. Then try to install the package after Visual Studio gets restarted.
NuGet 2.12 only supports Visual Studio 2013 and later. If you're on Visual Studio 2012 you're out of luck.
I struggled with this issue in Visual Studio 2010 when I was trying to add NewtonSoft.Json nuget package into my project. When I try to run the latest version of the nuget package from nuget package manager console:
PM> Install-Package Newtonsoft.Json
It results in the same error as mentioned by OP:
package requires NuGet client version '2.12' or above, but the current
NuGet version is '2.8.60318.667'.
So I thought I would update the NuGet extension in Visual Studio first to latest version. But when I went into Tools -> Extensions and Updates window the Updates tab wasn't showing any update for Nuget extension. So it seems NuGet client version 2.12 isn't available/supported in Visual Studio 2010 at all. I was running out of options now.
So finally, I tried to install a specific lower version (6.0.3) of Newtonsoft.Json package deliberately this way:
PM> Install-Package Newtonsoft.Json {Your Project Name} 6.0.3
This worked successfully.
Latest version of this package at the time of writing this post is 10.0.3 instead.
So, it might be the case that newer version of a nuget package is compatible with only latest version of nuget package manager. So sometimes explicitly installing a lower version of the package might help you. Older version of a nuget package will of course be compatible with older nuget extension in Visual Studio if it is not up-to-date.
The only caveat in this solution is that the functionalities present in lower version of the nuget package you target should suffice your current project needs. Good luck!
Note: Although I've elaborated this solution w.r.t. Visual Studio 2010 but you can try this work around for any Visual Studio version for that matter.
I find out the solution for this problem.
Basically you have a .nuget folder at solution level, that folder contains a nuget.exe file that probably is old. A lot of packages might need new version of that file.
Open this link: https://www.nuget.org/downloads
Download latest version of nuget.exe
Replace your .nuget/nuget.exe with this new version.
And try again, I'm confident it will work.
try
nuget update -self
my result:
Checking for updates from https://www.nuget.org/api/v2/.
Currently running NuGet.exe 2.8.7.
Updating NuGet.exe to 5.3.1.
Update successful.
This fix worked for me(I am using vs 2013, not sure if it will work for the rest), Go to Tools --> Extensions and Updates, then look for NuGet package manager for visual studio 2013, uninstall it. In the left pane select online which will take you to visual studio gallery, in the right pane search for NuGet package manager for visual studio 2013, it will bring you the right version to install. Install that and you are good to go, hope this sorts someone out.
Install-Package Newtonsoft.Json -Version 6.0.3
I got the same issue and I just clicked on "Restore NuGet package for this solution". In my case this solved the problem. Hope it will help.
I solved this problem, and my steps are as below:
1.Do what as "Mathivanan KP" said;
2.Delete the folder ".nuget", which is below your solution folder;
3.Rebuild your solution;
4.Back to your solution folder, and press "Ctrl + Z", then rebuild your solution again.
If the problem still there, i think you should clone the code from version manager to a new folder, and do the steps as before.
Hope it helpful to you.
You are updating the wrong package. Update your Nuget Package Manager and the error will be gone.
Update-Package NuGet.VisualStudio
https://www.nuget.org/packages/NuGet.VisualStudio
I try everything but nothing helps me. Than I change Visual Studio version from 2012 to 2015 everything is working Like a charm now.

Nuget version not correct?

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

Categories

Resources