nuget update -self error - nuget

Running nuget update -self from VS 2017 Developer Command Prompt I encountered the following error. How do I make nuget upgrade itself to the latest version?
Checking for updates from https://nuget.org/api/v2/.
Currently running NuGet.exe 2.0.30619.9000.
Updating NuGet.exe to 4.4.1.
The element 'metadata' in namespace 'http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd' has invalid child element 'developmentDependency' in namespace 'http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd'. List of possible elements expected: 'title, tags, summary, licenseUrl, releaseNotes, copyright, description, projectUrl, frameworkAssemblies, language, references, dependencies, iconUrl' in namespace 'http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd'.

How do I make nuget upgrade itself to the latest version?
You can run the command nuget update -self from VS 2017 Developer Command Prompt without following error:
'nuget' is not recognized as an internal or external command, operable
program or batch file.
That means that you should added a path of nuget.exe to the environment variable before or you have a old nuget.exe under the path C:\Users\bboyl\Source.
If you want to update nuget itself, you could manually download the the newer version form nuget.org, Under the section titled "Windows x86 Commandline", replace the old version in the path on your PC.
BTW, It seems the nuget.exe version 2.0.30619.9000 of the system environment variable path is too low to automatically update. So we have to update it manually, just download the new version of nuget.exe.
For example, I have a nuget.exe with version 4.1.0.2450 under the path D:\NuGet4.0, then I set this path into the environment variable. After that, I could update the nuget.exe itself to 4.4.1 in the VS 2017 Developer Command Prompt:
Now we could also update nuget itself with the command nuget update -self.

Related

The 'UmbracoCms.Core 7.6.5' package requires NuGet client version '3.4.4' or above, but the current NuGet version is '2.8.1.0'

Intro
I am trying to create a project from the cloud using "UaaS.cmd".
I run it, fill the url and namespace and it start working. Then in the middle of the process I get the error:
Installing UmbracoCms.Core
The 'UmbracoCms.Core 7.6.5' package requires NuGet client version '3.4.4' or above, but the current NuGet version is '2.8.1.0'.
at NuGet.PackageWalker.CheckPackageMinClientVersion(IPackage package)
at NuGet.PackageWalker.Walk(IPackage package)
at NuGet.InstallWalker.ResolveOperations(IPackage package)
at NuGet.ProjectManager.Execute(IPackage package, IPackageOperationResolver resolver)
at Waasp.PackageInstaller.InstallPackage(String packageId, SemanticVersion version, String projectPath, String targetFolder)
But I have VS 2015 and VS 2017 installed. My Vs 2015 says that I have nuget version 3.5 installed and vs 2017 says that I have nuget v4.2.
What have I tried
I ran nuget in my cmd, but it was not a recognized so I've downloaded the latest version and have added it to my environment, so when I run cmd, go to the folder where I have my uaas.cmd file and type
nuget update -self
It tells me that I have nuget 4.2 and it is up to date. But when I try the uaas.cmd, the same error happens
I don't understand! where does it find 2.8.1.0?! why doesn't it take 4.2?
P.S: I also wrote on Umbraco forum, but I guess it is more related to the nuget client than umbraco
I wrote my question on our Umbraco too and it appeared to be their error :)
In case anyone ended up in the same situation as me:
This is the answer from Sebastiaan:
link to the topic
The problem is that UaaS.cmd does run nuget 2.8.1 in it (it's ILmerged into the waasp.exe it download).
I'm working on getting it updated but the v4 version of nuget.exe is missing some critical methods that we need to create the list of dependencies. So I'm looking into doing some trickery. Anyway, for now, just go into the .Core project and install Newtonsoft.Json and System.Threading.Tasks.Dataflow and then you should be fine!

Microsoft NuGet targets Error while building Project from Teamcity

I attempted in building the .NET Standard Library Project using .NET Framework 4.6.1 from Command prompt using MSBuild Commmand. I manage to succeed building the project from command prompt.
I tried the same MSBuild command to build the project from Teamcity Command line build step, but ended up getting the following error:
C:\Program Files (x86)\MSBuild\Microsoft\NuGet\Microsoft.NuGet.targets(140,5): error : The package Microsoft.NETCore.Portable.Compatibility
with version 1.0.1 could not be found in C:\Windows\system32\config\systemprofile\.nuget\packages\. Run a NuGet package restore to download the package.
I tried Restoring nuget.exe restore mysolution.sln but noting works.
Please help me to compile the solution from Teamcity command line step. Its strange to get compiled from command prompt but not from teamcity command line.
Looks like there is a known issue in NuGet when restoring packages using the LocalSystem account wherein the packages cannot be accessed under the C:\Windows\system32\config\systemprofile\.nuget\packages folder, even though account permissions should allow it (see this GH issue). The current recommended workaround is to use the NUGET_PACKAGES environment variable to specify another location for the packages (e.g. C:\NuGet\packages).

How to run Nuget update in TFS 2013 script

I'd like to have my TFS 2103 build update some of the NuGet packages in the project to their latest versions before the build.
I've written a pre-build script to do this by invoking the nugget.exe update command:
& .\.nuget\nuget update ".\XXX.Main.Web\XXX.Main.Web.csproj" -Source Initial -Safe -Id XXX.Feature.Test -Verbosity detailed
The log file contains:
Looking for installed packages in 'packages'. Updating
'XXX.Main.Web'... NuGet.CommandLineException: Unable to find
'XXX.Feature.Test'. Make sure they are specified in packages.config.
I've tried running the command manually on the build server from the command prompt and it works as I would expect. I've also checked that script is being run from the correct folder.
The package certainly exists in Packages.config.
Has anyone managed to get nugget.exe update working successfully within a TFS powershell script?
After much head scratching I've found that the pre-build script is run pre fetching the packages from NuGet. Running the powershell script manually after the build had completed was fine as the packages has subsequently downloaded.
The NuGet message is somewhat misleading.
My solution is to run a NuGet.exe restore command prior to runing the update command and everything now works.

How to use paket from command line

I installed paket from nuget in Nuget Package Manager Console with:
Install-Package paket
I then tried to run paket convert-from-nuget. It stalled out on a user prompt (it wouldn't let me type into the package manager console). My next thought was to run it from command line, but how to do so is not documented.
Just putting paket convert-from-nuget into a standard dev command prompt results in an error saying "paket" is not recognized.
How do I run paket from the command line or powershell, and how do you specify which solution to work against?
The way to setup paket in your repository is as follow:
1 Download a release of paket.bootstrapper.exe
This is a lightweight utility which obtains and updates paket.exe, pick stable release from official release page:
https://github.com/fsprojects/Paket/releases
2 create a .paket folder
md .paket
3 put the downloaded bootstrapper in this folder and invoke it
cd .paket
paket.bootstrapper
now you have an up-to-date paket.exe ready to ease your handling of dependencies.
4 convert from nuget
cd ..
.paket\paket convert-from-nuget
Please checkout the https://github.com/fsprojects/Paket.VisualStudio also for Visual Studio plugin to help you authoring paket.dependencies and paket.references file
Please also join https://gitter.im/fsprojects/Paket if you have any questions.
The Chocolatey package modifies the PSModulePath envivornment variable. I've observed that sometimes that modification isn't picked up until the system is restarted (or at least not until the user logs out and back in again). In the meantime, you can import the module using:
Import-Module <path-to-packages>\Paket.PowerShell\Paket.PowerShell.psd1
The packages path is usually something like C:\Chocolatey\lib. OTOH, re-reading your question, are you referring to the Nuget inside of Visual Studio? If so, that downloads from NuGet.org and that pkg puts paket.exe in $(SolutionDir)\packages\Pakget.1.18.5\tools\paket.exe. Your version number may varying.
Unfortunately the fact that PowerShell V5 introduces Install-Package (which downloads from Chocolatey by default) is going to get a little confusing vis-a-vie the NuGet Package Manager Console's Install-Package in Visual Studio.

How do you query installed nuget packages with the command line interface?

I need to find the installed version of a package inside my CI build script using the nuget command line.
The "list" command returns ALL packages from the nuget.org feed as far as I can tell. I only want the locally installed packages.
I know how to do this with the VS nuget powershell console. Please do not answer "use get-package". I need to do it with the nuget.exe.
However if there's a way to use the nuget command from plain powershell outside of visual studio that would be acceptable.
nuget list -Source http://my.local.feed/ will list packages available in a local feed, and dir .\packages from within the top-level solution folder will show the packages installed under that location (where .\packages is the install location you have set for the solution).
From http://docs.nuget.org/docs/reference/command-line-reference#List_Command_Options and How do I specify the directory where NuGet packages are installed?