1

I am using TFS 2017 and NuGet Installer - 0 task for NuGet restore in build definition but getting an error unable to find version.

It's using below command for restoring packages

D:\agent\_work\_tasks\NuGetInstaller_333b11bd-d341-40d9-afcf-b32d5ce6f23b\0.2.31\node_modules\nuget-task-common\NuGet\3.3.0\NuGet.exe restore -NonInteractive D:\agent\_work\42\s\xyz\xyz.sln -Verbosity Detailed

Unable to find version '3.2.7' of package 'Microsoft.AspNet.WebPages'.
2020-06-15T14:50:36.6499535Z Unable to find version '5.2.7' of package 'Microsoft.AspNet.WebApi.WebHost'.
2020-06-15T14:50:36.6499535Z Unable to find version '5.2.7' of package 'Microsoft.AspNet.WebApi.Core'.
2020-06-15T14:50:36.6499535Z Unable to find version '5.2.7' of package 'Microsoft.AspNet.WebApi.Client'.
2020-06-15T14:50:36.6499535Z Unable to find version '5.2.7' of package 'Microsoft.AspNet.Mvc'.

But when I run same above command manually on the agent it's working fine also tried updating NuGet task version.

Naveen Kumar
  • 1,266
  • 1
  • 21
  • 50
  • 1
    Hi @Naveen have you tried to tick the include nuget.org search in the nuget task. I'm not sure of the exact name but there should be a option to check so it looks in nuget.org – Etienne Jun 15 '20 at 19:38
  • 1
    Hi @Etienne thanks I have tried this solution and it's working fine. – Naveen Kumar Jun 17 '20 at 17:21

2 Answers2

4

Unable to find version '3.2.7' of package xxx

Agree with Etienne. The versions of these packages can be found in nuget.org.

When you use the Nuget Restore task in TFS2017, you could try the following methods to use the nuget.org.

  1. Use the Nuget Restore task V1. Select the Use Packages from nuget.org option.

enter image description here

  1. If you use the nuget.config file , you could add the nuget.config package source in the file.

    <?xml version="1.0" encoding="utf-8"?> <configuration> <packageSources> <clear /> <add key="nuget.org" value="https://api.nuget.org/v3/index.json"protocolVersion="3" /> </packageSources> </configuration>

Here is a doc about nuget.config file.

Hope this helps.

Kevin Lu-MSFT
  • 20,786
  • 3
  • 19
  • 28
2

We had the same problem on one of our projects since this morning (16 June 2020) and we needed to upgrade our Nuget.exe. I can see you're using Nuget 3.3 and the current recommended version is 5.5.1.

It seems to be installed by a npm package.

D:\agent\_work\_tasks\NuGetInstaller_333b11bd-d341-40d9-afcf-b32d5ce6f23b\0.2.31\node_modules\nuget-task-common\NuGet\3.3.0\NuGet.exe

The latest version is here: https://www.nuget.org/downloads

Replacing it with the latest stable version worked.

EDIT: The reason old Nuget versions no longer works is because GitHub dropped support for TLS 1.0 and 1.1.

https://i.stack.imgur.com/ZN9sF.png (can't submit pictures yet)