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
Related
I'm helping a colleague who cannot get a Visual Studio WPF project to build in our TFS 2015 build server. I've pulled (get latest) the latest version of his code into my VS 2019 instance. I can't get it to build on my dev box. When I try to build the solution on my dev box I get errors like thing:
The tag 'ModernDialog' does not exist in XML namespace 'http://firstfloorsoftware.com/ModernUI'.
The tag 'Interaction.Triggers' does not exist in XML namespace 'http://schemas.microsoft.com/expression/2010/interactivity'.
When my colleague checks in changes into TFS, it fails with errors like this:
Unable to find version '5.2.0' of package 'MvvmLightLibs'.
Unable to find version '1.0.9' of package 'ModernUI.WPF'.
I started by trying to update the NuGet packages he had in the project, but that hasn't worked well. Even restoring back to the latest version doesn't build on my machine.
My colleague's approach is to rip all NuGet packages out of the Visual Studio solution, then look around to find the DLLs, then put them into the project and reference them in the project. It does build on his system but doesn't on the TFS build server.
So, I've been looking around for probable causes. I came across this Microsoft document Migrate from packages.config to PackageReference. I'm not familiar with either packages.config or PackageReference, but I get the feeling that PackageReference is the "preferred" way of including NuGet packages.
This raises problems. Currently our TFS build server's highest version of Visual Studio is VS 2015. According to the referenced article, VS 2015 uses packages.config files. Anything newer than VS 2015 uses Packages (PackageReference I presume).
I've compared the failing WPF solution with another one I've worked on which builds fine on the build server. The solution that builds, I'll call it SolutionA, has a packages folder at the root of the solution, but it also has packages.config files in each project in the solution. The solution that fails to build, I'll call it SolutionB, has the packages folder at its root, and one packages.config file in the unit test project. (I think the unit project builds fine.)
Even though we're working with newer versions of Visual Studio, I suspect that the problem the build server is having is due to the build server having an older version of Visual Studio. We have a limited number of licenses for Visual Studio, so I can't put a newer version of Visual Studio on the build server. So, how do I get those packages.config files into each projects?
First, your solution actually uses packages.config nuget management format. And this format makes every project has a file called packages.config which lists all the nuget packages and their versions. That is the feature of packages.config nuget management format. So you should also make sure that you have commit that file into TFS.
Second, that migrate packages.config into PackageReference is not an easy work and it should be done with VS IDE. Mostly, you have to make a big change to every csproj file of the project. Actually, PackageReference is flexible and lightweight, it does not have the packages.config file and packages folder which stores all the nuget packages. Just embed them directly in proj file. And so far, PackageReference is the mainstream.
Your problem is that you did not do a nuget restore operation on TFS build to make the missing nuget packages under the packages folder so that build process will find those nuget packages and make them work.
You should add a nuget restore xxx\sln command line or task.
Please check one,two,three.
I am working on a project on TFS. This project was created on someone else's PC on VS 2017 and the newest .NET framework and published to Azure.
I got the project on my PC, I have VS 2015 and I had to change the .NET framework of the project to 4.6. Everything was fine, I could make changes to the project and commit.
But when I tried to publish to Azure from my PC, I got a very unclear error:
Publish Failed
Connecting to ...
Looking for solutions online, I had to downgrade the version of the package Microsoft.Net.Compilers from 2.6.1 to 2.4.0 . And that worked !
I turned off my PC. Next day when I opened the project and ran it, I got this error locally :
Could not load file or assembly 'Microsoft.ApplicationInsights, Version=2.6.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
I tried to uninstall Microsoft.ApplicationInsights and reinstall it with version 2.6.1 , but it says i need a newer version of nuget.
I am not sure how to proceed from here. I already installed all the updates in my Tools -> Extensions -> Updates but nothing changed.
Why are all these things happening to my project and how can i fix it?
PS: upgrading my VS to 2017 is currently not an option due to many exterior reasons.
Thank you.
I've gotten that error locally as well and was actually able to resolve by manually adding the file to my project folder, may be worth a shot.
Downgrading .NET Framework causing packages issues
Just like Hans said nuget packages change quite rapidly, which often require the latest version NuGet. Some new features in the package only supported by the newer NuGet (like PackageReference) or some issues fixed on the newer version. For example, install package Microsoft.EntityFrameworkCore.SqlServer 2.1.1 on Visual Studio 2015, which requires NuGet client version '3.6.0' or above.
So, the workaround for this issue is create a new project with Visual Studio 2015, copy the code from previous projects, then add those nuget package one by one to find out the reason why it needs the newer version nuget.
However, I want to talk more over about this question is that the best way to resolve this issue is to install Visual Studio 2017 alongside Visual Studio 2015. As we known, using a lower version of the Visual Studio and .net framework to open a higher version of the Visual Studio and .net framework is not recommended, it will always bring a lot of incompatibility errors and some other weird issues. Since upgrade your Visual Studio to 2017 is currently not an option due to many exterior reasons, so I suggest that you can install Visual Studio 2017 alongside Visual Studio 2015. Besides, developing the same project with different versions of Visual Studio and submitting it to the TFS server may bring many unpredictable risks.
Hope this helps.
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
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
I am following this article on RazorGenerator and it say's that I must add references to:
System.Web.Helpers.dll
System.Web.WebPages.dll
System.Web.Razor.dll
The only one I can see when I do Add Reference is System.Web.Razor, but I don't know where the other ones are.
You will find these assemblies in the Extensions group under Assemblies in Visual Studio 2010, 2012 & 2013 (Reference Manager)
To sum up all of the options for VS 2017, WebHelpers was installed by installing MVC in previous versions of Visual Studio. If you're getting this error, you probably don't have the older versions of VS installed anymore.
So, installing the Microsoft.AspNet.MVC NuGet package will require Microsoft.AspNet.WebPages and Microsoft.AspNet.Razor, and the Microsoft.AspNet.WebPages includes System.Web.Helpers.dll.
If you've got direct references to System.Web.Mvc.dll and you don't want to use NuGet for MVC, you can get the Microsoft.AspNet.WebPages NuGet, or there are some other NuGet packages that only contain System.Web.Helpers.dll, like the microsoft-web-helpers or System-Web-Helpers.dllpackages.
There appear to be 2 versions of System.Web.Helpers.dll, one for .Net 4.0 and one for 4.5. Choosing the correct version of MVC or AspNet.WebPages will ensure you get the right one.
As for VS2017 I didn't find it in "extensions", there's a Nuget package called "microsoft-web-helpers" that seems to be equivalent to System.Web.Helpers.
I had the same problem , first I couldn't find those dlls in the list of .NET components . but later I figured it out that the solution is :
1- first I changed target framework from .NET framework 4 client profile to .NET framework 4.
2- then scroll down the list of .NET components , pass first list of system.web... , scroll down , and find the second list of system.web... at the bottom , they're there .
I hope this could help others
In VS 2010 just right click on project or on reference and click add reference.
On the popup window Select Assemblies - > Extensions -> System.Web.Helpers
Installing ASP.NET MVC3 from here should help.
On VS2017 I installed the NuGet package: Microsoft.AspNet.WebPages
That did the trick.
This particular NuGet package has a habit of losing its references in one of our projects. From time to time I will need to run the following command in the Package Manager Console to restore the references and everything is OK again
Update-Package Microsoft.AspNet.Webpages -reinstall
I had to install RazorGenerator.Templating to get it all to work. From the NuGet console, type:
Install-Package RazorGenerator.Templating
They should be under C:\Program Files\Microsoft ASP.Net (or C:\Program Files (x86)\Microsoft ASP.Net if you're on a 64-bit OS) in a subfolder for MVC3 or WebPages.
The issue is a missing or outdated version of MVC. I was running VS 2015Preview and could resolve the issue by installing the latest version of MVC via NuGet.
Just in case anyone is still coming across this one.
When you install this nuget package Microsoft.AspNet.WebPages they can be find in C:\Program Files (x86)\Microsoft Visual Studio\Shared\Packages\Microsoft.AspNet.WebPages.x.x.x\lib\net45